PHP 8.1
Posted: 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
Ich bin kein php Programmierer, denke aber jemand kann das leicht anpassen kann.
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
zu finden: https://php.watch/versions/8.1/ReturnTypeWillChange#[\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) {}
// ...
}
Ich bin kein php Programmierer, denke aber jemand kann das leicht anpassen kann.