simple-php-router
simple-php-router copied to clipboard
Problema con PHP 8.1.2
Deprecated: Return type of Pecee\Http\Input\InputItem::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\xampp\htdocs\apigastosreales\vendor\pecee\simple-router\src\Pecee\Http\Input\InputItem.php on line 84
Tal como lo indica agregue la linea #[\ReturnTypeWillChange] para quitar el aviso temporalmente
Hello,
first it would be great if you can write in english.
We currently cannot add the #[\ReturnTypeWillChange] Attribute, because attributes were intoduced in PHP 8 and we are currently compatible with PHP 7.1.
Also we cannot use the union type mixed, bacause that was also intoduced in PHP 8.
Feel free to add the attribute in your code.
Alternativly you can change your code from
foreach($inputitem as $value){
echo $value;
}
to
foreach($inputitem->getValue() as $value){
echo $value;
}
I currently don't know if not using the methods provided by ArrayAccess will suppress this notice, but I think it is worth a try.
Please let me know if using getValue() suppresses the notice.
@skipperbent we have to update the project to PHP 7.3 or 7.4 soon. The version is not supported anymore, like I mentioned in PR #515 and PR #611. A temporary solution would be to remove the ArrayAccess interface from the InputItem class. What do you think @skipperbent?
~ Marius
Hello, did this fix work for you?
~ Marius