PHP 8.1

A place to report and discuss bugs - please mention CMSimple-version, server, platform and browser version
Post Reply
Schachberg
Posts: 8
Joined: Tue Dec 25, 2018 10:12 am
Location: Gau-Algesheim

PHP 8.1

Post by Schachberg » Thu Mar 10, 2022 6:00 pm

Ich habe die neueste Version xampp (mit php 8.1) als Testbereich installiert und festgestellt, das 8.1 eine Warnung mit sich bringt.
Ich denke ich habe die neuste CMSimple-XH Version 1.7.5 Released: 2021-10-03
Warnund DEPRECATED:
Return type of XH\PluginConfig::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Es geht um diese codes:

cmsimple\classes\PluginConfig.php:

52 public function offsetExists($offset)
67 public function offsetGet($offset)
83 public function offsetSet($offset, $value)
98 public function offsetUnset($offset)

Ein wenig googeln ergab dann Folgendes. Es liegt offensichtlich speziell an PHP 8.1
#[\ReturnTypeWillChange]
public function offsetExists($offset)

#[\ReturnTypeWillChange] is a new attribute introduced in PHP 8.1, which signals that a mismatching tentative return type should not emit a deprecation notice.

PHP versions prior to 8.0 parses the attribute syntax as a code comment, and does not cause any syntax errors. Adding #[\ReturnTypeWillChange] attribute to a class method does not cause any issues, but omits the deprecation notice in PHP 8.1.

This is the first built-in attribute added to PHP.

class Foo implements ArrayAccess {
#[\ReturnTypeWillChange]
public function offsetGet(mixed $offset) {}
// ...
}
zu finden: https://php.watch/versions/8.1/ReturnTypeWillChange
Ich bin kein php Programmierer, denke aber jemand kann das leicht anpassen kann.
Schachberg

olape
Posts: 2731
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: PHP 8.1

Post by olape » Thu Mar 10, 2022 6:30 pm

Gruß Olaf, Plugins for CMSimple_XH

Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.

Schachberg
Posts: 8
Joined: Tue Dec 25, 2018 10:12 am
Location: Gau-Algesheim

Re: PHP 8.1

Post by Schachberg » Thu Mar 10, 2022 9:34 pm

Danke olape, hatte ich nicht gesehen.
Ich glaube in der geänderten Datei fehlt in der Zeile 100 ein "\" #[\ReturnTypeWillChange]
Schachberg

olape
Posts: 2731
Joined: Fri Mar 13, 2015 8:47 am
Contact:

Re: PHP 8.1

Post by olape » Fri Mar 11, 2022 6:50 am

Schachberg wrote:
Thu Mar 10, 2022 9:34 pm
Danke olape, hatte ich nicht gesehen.
Kein Problem, geht mir auch oft so.
Schachberg wrote:
Thu Mar 10, 2022 9:34 pm
Ich glaube in der geänderten Datei fehlt in der Zeile 100 ein "\"
Da hast du sicher recht.
Gruß Olaf, Plugins for CMSimple_XH

Ich habe schon lange den Verdacht, dass so viele so eifrig auf Gender, Trans und Queer machen:
Weil sie für das Fachliche ganz einfach zu doof sind.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: PHP 8.1

Post by cmb » Fri Mar 11, 2022 11:24 am

Schachberg wrote:
Thu Mar 10, 2022 9:34 pm
Ich glaube in der geänderten Datei fehlt in der Zeile 100 ein "\" #[\ReturnTypeWillChange]
Wurde inzwischen bereits erledigt.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply