2

After updating my Magento store to version 2.4.6, I'm encountering a deprecated functionality error when visiting the admin page. The front-end, however, works fine.

Deprecated Functionality: Creation of dynamic property Magento\Framework\Acl::$_roleRegistry is deprecated in vendor/magento/framework/Session/SessionManager.php on line 186.

The code at line 186 in SessionManager.php is

session_start();
if (isset($_SESSION['destroyed'])
    && $_SESSION['destroyed'] < time() - $this->sessionConfig->getCookieLifetime()
) {
    $this->destroy(['clear_storage' => true]);
}

1 exception(s):
Exception #0 (Exception): Deprecated Functionality: Creation of dynamic property Magento\Framework\Acl::$_roleRegistry is deprecated in vendor/magento/framework/Session/SessionManager.php on line 186

<pre>#1 session_start() called at [vendor/magento/framework/Session/SessionManager.php:186]
#2 Magento\Framework\Session\SessionManager->start() called at [generated/code/Magento/Backend/Model/Auth/Session/Interceptor.php:32]
#3 Magento\Backend\Model\Auth\Session\Interceptor->start() called at [vendor/magento/framework/Session/SessionManager.php:123]
#4 Magento\Framework\Session\SessionManager->__construct() called at [vendor/magento/module-backend/Model/Auth/Session.php:104]
#5 Magento\Backend\Model\Auth\Session->__construct() called at [generated/code/Magento/Backend/Model/Auth/Session/Interceptor.php:14]
#6 Magento\Backend\Model\Auth\Session\Interceptor->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]
#7 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:108]
#8 Magento\Framework\ObjectManager\Factory\Compiled->create() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
#9 Magento\Framework\ObjectManager\Factory\Compiled->get() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
#10 Magento\Framework\ObjectManager\Factory\Compiled->create() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
#11 Magento\Framework\ObjectManager\Factory\Compiled->get() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:79]
#12 Magento\Framework\ObjectManager\Factory\Compiled->create() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:150]
#13 Magento\Framework\ObjectManager\Factory\Compiled->get() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:125]
#14 Magento\Framework\ObjectManager\Factory\Compiled->parseArray() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:86]
#15 Magento\Framework\ObjectManager\Factory\Compiled->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
#16 Magento\Framework\ObjectManager\ObjectManager->get() called at [vendor/magento/framework/App/FrontController.php:109]
#17 Magento\Framework\App\FrontController->__construct() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:14]
#18 Magento\Framework\App\FrontController\Interceptor->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]
#19 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:108]
#20 Magento\Framework\ObjectManager\Factory\Compiled->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]
#21 Magento\Framework\ObjectManager\ObjectManager->get() called at [vendor/magento/framework/App/Http.php:115]
#22 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#23 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]
</pre>

Result of grep -rn "magento/zendframework1" .

./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:1819:                "magento/zendframework1": "~1.14.0",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:2280:                "magento/zendframework1": "~1.14.1",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:9570:                "magento/zendframework1": "~1.14.1",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:9702:            "name": "magento/zendframework1",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.lock:2518:            "name": "magento/zendframework1",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.json:23:        "magento/zendframework1": "*",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:1819:                "magento/zendframework1": "~1.14.0",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:2280:                "magento/zendframework1": "~1.14.1",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:9570:                "magento/zendframework1": "~1.14.1",
./dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:9702:            "name": "magento/zendframework1",
./dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock:3991:                "magento/zendframework1": "1.12.10",
./dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock:4169:            "name": "magento/zendframework1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:1819:                "magento/zendframework1": "~1.14.0",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:2280:                "magento/zendframework1": "~1.14.1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:9570:                "magento/zendframework1": "~1.14.1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:9702:            "name": "magento/zendframework1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.lock:2518:            "name": "magento/zendframework1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.json:23:        "magento/zendframework1": "*",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:1819:                "magento/zendframework1": "~1.14.0",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:2280:                "magento/zendframework1": "~1.14.1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:9570:                "magento/zendframework1": "~1.14.1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:9702:            "name": "magento/zendframework1",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock:3991:                "magento/zendframework1": "1.12.10",
./vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock:4169:            "name": "magento/zendframework1",
./vendor/magento/magento2-base/CHANGELOG.md:3727:    * ZF1 library is represented by 'magento/zendframework1', which is based on original "1.12.9" version and includes fixes for compatibility with Magento 2 application
Binary file ./.git/index matches
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:1819:                "magento/zendframework1": "~1.14.0",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:2280:                "magento/zendframework1": "~1.14.1",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:9570:                "magento/zendframework1": "~1.14.1",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock:9702:            "name": "magento/zendframework1",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.lock:2518:            "name": "magento/zendframework1",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromClone/composer.json:23:        "magento/zendframework1": "*",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:1819:                "magento/zendframework1": "~1.14.0",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:2280:                "magento/zendframework1": "~1.14.1",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:9570:                "magento/zendframework1": "~1.14.1",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock:9702:            "name": "magento/zendframework1",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock:3991:                "magento/zendframework1": "1.12.10",
./vendor2/magento/magento2-base/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock:4169:            "name": "magento/zendframework1",
./vendor2/magento/magento2-base/CHANGELOG.md:3727:    * ZF1 library is represented by 'magento/zendframework1', which is based on original "1.12.9" version and includes fixes for compatibility with Magento 2 application
./CHANGELOG.md:3727:    * ZF1 library is represented by 'magento/zendframework1', which is based on original "1.12.9" version and includes fixes for compatibility with Magento 2 application
 

Magento 2.4.6 Php 8.2

4 Answers 4

1

I didn't face this error but let me try to help you debugging.

The call Magento\Framework\Acl::$_roleRegistry is come from Zend_Acl::_getRoleRegistry() method which is included in the Zendframework1 package (vendor/magento/zendframework1/library/Zend/Acl.php).

In Magento 2.4.6, the Zendframework package was replaced by the Laminas package.

The appropriate Acl class is Laminas\Permissions\Acl\Acl (magento/vendor/laminas/laminas-permissions-acl/src/Acl.php) where they remove the underscore character in $roleRegistry property in getRoleRegistry() method to following PSR-2 coding standard.

The root cause of your issue is your project using magento/zendframework1 package instead of laminas packages as Magento core.

Try to remove the vendor directory and run composer install to reinstall composer packages, maybe magento/zendframework1 packages can be removed. Then run the setup:upgrade command and compile code, deploy static content, and check to know if the issue is solved or not.

If the answer is no, that means one of your composer.json in your project code requires magento/zendframework1 package. Let's search in the whole project code with the search term "magento/zendframework1" to get the result:
Run the below command in the Magento root directory:

grep -rn "magento/zendframework1" .

And add the output to your original question, I'll let you know the next step.

9
  • I update Result of grep -rn "magento/zendframework1" . Thanks so much for your help Tu Van!
    – Yohan
    May 7, 2023 at 4:21
  • @Yohan the output looks good, nothing is incorrect here. Have you done the solution of deleting the vendor directory and running the commands?
    – Tu Van
    May 7, 2023 at 4:29
  • Yes. I have changed the vendor directory name to vendor2, and then composer install. Then run the setup:upgrade command and compile code, deploy static content. Get the same issue.
    – Yohan
    May 7, 2023 at 5:48
  • 1
    That's weird. So, I suspect this is a cache issue. Do you use Redis and (or) Varnish for caching on your site? Which environment (Dev/Test/Staging/Production) are you working on this issue? Please remove var/cache/* and var/page_cache/* directories and in case your site uses Redis cache, flush the Redis cache. Then rerun all Magento commands I mentioned above and check the result.
    – Tu Van
    May 8, 2023 at 3:50
  • 1
    @yohan all the instances listed from your grep are test, so I would assume that sites that work composer is run with --no-dev and those that don't work have all the dev stack
    – iphigenie
    May 9, 2023 at 9:13
1

I got the same problem. I created an issue on github for it. https://github.com/magento/magento2/issues/37469

I have also solved it temporary by editing SessionManager.php

//                if (isset($_SESSION['destroyed'])
//                    && $_SESSION['destroyed'] < time() - $this->sessionConfig->getCookieLifetime()
//                ) {
//                    $this->destroy(['clear_storage' => true]);
//                }

                if (isset($_SESSION['destroyed'])
                    && $_SESSION['destroyed'] < time() - $this->sessionConfig->getCookieLifetime()
                ) {
                    $this->destroy(['clear_storage' => true]);
                } elseif (!isset($this->_roleRegistry)) {
                    $this->_roleRegistry = null;
                } 
1
  • Thanks for your answer and created an issue! After I apply your solution, I get other error and now front-end get issue (detail is on github) Could you help?
    – Yohan
    May 5, 2023 at 22:42
0

Removing modules that have magento/zendframework1 as dependency and clearing redis cache should solve the issue in most cases.

0

Maybe sounds obvious, but in my case clearing of local storage, session storage and cookies (of "Application" tab in Chrome DevTools) helped to "manage" the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.