magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.45k stars 9.29k forks source link

Deprecated Functionality: Creation of dynamic property Magento\Framework\Acl::$_roleRegistry #37469

Open gladroger opened 1 year ago

gladroger commented 1 year ago

Preconditions and environment

After updating Magento CE from 2.4.5-p1 to 2.4.6, cant enter admin panel anymore.

Found the same error mentioned here: https://magento.stackexchange.com/questions/366673/deprecated-functionality-error-in-sessionmanager-php-on-line-186-after-update-to

PHP 8.2.5 on Centos 7

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

#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 [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#23 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#24 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]
` ### Steps to reproduce 1. Open admin panel after upgrade ### Expected result Get into admin ### Actual result Error. ### Additional information _No response_ ### Release note _No response_ ### Triage and priority - [ ] Severity: **S0** _- Affects critical data or functionality and leaves users without workaround._ - [X] Severity: **S1** _- Affects critical data or functionality and forces users to employ a workaround._ - [ ] Severity: **S2** _- Affects non-critical data or functionality and forces users to employ a workaround._ - [ ] Severity: **S3** _- Affects non-critical data or functionality and does not force users to employ a workaround._ - [ ] Severity: **S4** _- Affects aesthetics, professional look and feel, “quality” or “usability”._
m2-assistant[bot] commented 1 year ago

Hi @gladroger. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 1 year ago

Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

gladroger commented 1 year ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 1 year ago

Hi @gladroger. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 1 year ago

Hi @gladroger, here is your Magento Instance: https://d020edf674112cba5e0bb45e349368d2.instances-prod.magento-community.engineering Admin access: https://d020edf674112cba5e0bb45e349368d2.instances-prod.magento-community.engineering/admin_8c02 Login: 4b3266ef Password: 2932c4560e12

gladroger commented 1 year ago

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;
            } 
yohangwak commented 1 year ago

@gladroger Thanks for this!

After I apply your solution, I get other error on front-end and admin

main.CRITICAL: Exception: Deprecated Functionality: Creation of dynamic property Magento\Framework\Session\Generic\Interceptor::$_roleRegistry is deprecated in vendor/magento/framework/Session/SessionManager.php on line 198 in vendor/magento/framework/App/ErrorHandler.php:62 Stack trace:

0 vendor/magento/framework/Session/SessionManager.php(198): Magento\Framework\App\ErrorHandler->handler()

1 vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\Session\SessionManager->start()

2 vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Session\Generic\Interceptor->___callParent()

3 vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\Session\Generic\Interceptor->Magento\Framework\Interception{closure}()

4 generated/code/Magento/Framework/Session/Generic/Interceptor.php(41): Magento\Framework\Session\Generic\Interceptor->___callPlugins()

5 vendor/magento/framework/Session/SessionManager.php(123): Magento\Framework\Session\Generic\Interceptor->start()

6 generated/code/Magento/Framework/Session/Generic/Interceptor.php(14): Magento\Framework\Session\SessionManager->__construct()

7 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Framework\Session\Generic\Interceptor->__construct()

8 vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject()

9 vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create()

10 vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get()

11 vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create()

12 vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get()

13 vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create()

14 vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\Framework\ObjectManager\Factory\Compiled->get()

15 vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\Framework\ObjectManager\Factory\Compiled->create()

16 vendor/magento/framework/ObjectManager/Factory/Compiled.php(125): Magento\Framework\ObjectManager\Factory\Compiled->get()

17 vendor/magento/framework/ObjectManager/Factory/Compiled.php(86): Magento\Framework\ObjectManager\Factory\Compiled->parseArray()

18 vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Compiled->create()

19 vendor/magento/framework/App/FrontController.php(109): Magento\Framework\ObjectManager\ObjectManager->get()

20 generated/code/Magento/Framework/App/FrontController/Interceptor.php(14): Magento\Framework\App\FrontController->__construct()

21 vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Framework\App\FrontController\Interceptor->__construct()

22 vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject()

23 vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Compiled->create()

24 vendor/magento/framework/App/Http.php(115): Magento\Framework\ObjectManager\ObjectManager->get()

25 generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()

26 vendor/magento/framework/App/Bootstrap.php

gladroger commented 1 year ago

@yohangwak

I was in a hurry to get live again so I also changed the error reporting setting. I had lots of small problems during the day but some were due to 3rd party modules.

app/bootstrap.php error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);

engcom-Bravo commented 1 year ago

Hi @gladroger,

Thank you for reporting and collaboration.

Verified the issue while upgrading from Magento 2.4.5-p1 to Magento 2.4.6(latest version) we are not able to reproduce the issue. Kindly refer the attached video.

We are able to enter the admin panel successfully.

Screenshot 2023-05-09 at 2 12 59 PM

https://user-images.githubusercontent.com/51680745/237043741-b67b9c28-980a-4df0-8886-3967a61216f5.mov

Kindly check the issue while upgrading from 2.4.5-p1 to 2.4.6 and check if any 3rd party extensions / modules enabled is causing this issue.

Thanks.

gladroger commented 1 year ago

What php version are you using when testing?

engcom-Bravo commented 1 year ago

Hi @gladroger,

Thanks for your update.

We are using php 8.1.

Screenshot 2023-05-11 at 12 36 14 PM

Thanks.

yohangwak commented 1 year ago

Hi @gladroger,

Thanks for your update.

We are using php 8.1.

Screenshot 2023-05-11 at 12 36 14 PM

Thanks.

Can you try with php 8.2? I get error with php 8.2

engcom-Bravo commented 1 year ago

Hi @gladroger,

Thanks for your update.

Verified the issue while upgrading from Magento 2.4.5-p1 to Magento 2.4.6(latest version) we are not able to reproduce the issue.Kindly refer the screenshots.

We have installed with php 8.2

Screenshot 2023-05-25 at 4 50 55 PM Screenshot 2023-05-25 at 4 50 37 PM Screenshot 2023-05-25 at 2 37 25 PM Screenshot 2023-05-25 at 4 49 50 PM

Kindly check the issue while upgrading from 2.4.5-p1 to 2.4.6 and check if any 3rd party extensions / modules enabled is causing this issue.

Thanks.

engcom-Bravo commented 1 year ago

Hi @gladroger,

We have noticed that this issue has not been updated for a period of 14 Days.
Hence we assume that this issue is fixed now, so we are closing it. Please raise a fresh ticket or reopen this ticket if you need more assistance on this.

Thanks.

minhluan259 commented 1 year ago

@gladroger I have similar issue with v2.4.7-beta1

I fixed it by adding: public $roleRegistry; to vendor/magento/framework/Acl.php:34

maderlock commented 9 months ago

@engcom-Bravo Please re-open as this continues to be an issue

domeglic commented 8 months ago

I had the same problem while updating from 2.4.5 to 2.4.6. I think it happens if you have an admin session and then update, because after clearing the sessions I didn't have this problem. That class must somehow be serialized in the session with the old variable name _roleRegistry which got renamed.

So not a real issue.

arunkumar2687 commented 6 months ago

I see the same on Upgrading from Adobe Commerce Cloud 2.4.3-p1 to 2.4.6-p4

report.CRITICAL: Exception: Deprecated Functionality: Creation of dynamic property Magento\Framework\Session\Generic\Interceptor::$_roleRegistry is deprecated in /app//vendor/magento/framework/Session/SessionManager.php on line 197 in /app//vendor/magento/framework/App/ErrorHandler.php:62

cbradleyacadaca commented 6 months ago

Issue is caused by existing admin session. All you need to do is clear browser cookies and I also ran this MySQL script: delete from admin_user_session;

m2-assistant[bot] commented 1 month ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 1 month ago

Hello @gladroger,

Thanks for reporting the issue!

The issue is reproducible for us, we are getting the error after upgrading Magento to 2.4.7-p1.

@cbradleyacadaca Thanks for the resolution.

Confirming this issue for further processing.

Thanks

github-jira-sync-bot commented 1 month ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12343 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 month ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.