Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error Zend_Memory_Value not compatible with ArrayAccess #50

Open
Nuranto opened this issue Jul 11, 2022 · 2 comments
Open

Fatal error Zend_Memory_Value not compatible with ArrayAccess #50

Nuranto opened this issue Jul 11, 2022 · 2 comments

Comments

@Nuranto
Copy link

Nuranto commented Jul 11, 2022

PHP Fatal error: During inheritance of ArrayAccess: Uncaught Exception: Deprecated Functionality: Return type of Zend_Memory_Value::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/magento/zendframework1/library/Zend/Memory/Value.php

Here's a patch :

--- a/library/Zend/Memory/Value.php
+++ b/library/Zend/Memory/Value.php
@@ -86,7 +86,7 @@
      * @param integer $offset
      * @return boolean
      */
-    public function offsetExists($offset)
+    public function offsetExists(mixed $offset): bool
     {
         return $offset >= 0  &&  $offset < strlen($this->_value);
     }
@@ -98,7 +98,7 @@
      * @param integer $offset
      * @return string
      */
-    public function offsetGet($offset)
+    public function offsetGet(mixed $offset): mixed
     {
         return $this->_value[$offset];
     }
@@ -110,7 +110,7 @@
      * @param integer $offset
      * @param string $char
      */
-    public function offsetSet($offset, $char)
+    public function offsetSet(mixed $offset, mixed $value): void
     {
         $this->_value[$offset] = $char;
 
@@ -126,7 +126,7 @@
      *
      * @param integer $offset
      */
-    public function offsetUnset($offset)
+    public function offsetUnset(mixed $offset): void
     {
         unset($this->_value[$offset]);

cf magento/magento2#35335

@xmav
Copy link

xmav commented Jul 19, 2022

Hi @Nuranto !
Could you please provide steps to reproduce for this issue ?

@Nuranto
Copy link
Author

Nuranto commented Jul 25, 2022

Yes, you can execute any of these methods on a PHP8.1 environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants