Bug #88984

Exception in BackendController 'Cannot use object of type stdClass as array' on $collapseState ( line 254 )

Added by Philipp Parzer 26 days ago. Updated 23 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2019-08-20
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

After updating to v9.5.9 and logging in to the backend i instantly received this exception.

The result of my debugging says that $this->getBackendUser()->uc['BackendComponents']['States']['typo3-module-menu'] is an object of type stdClass and so the ['collapsed'] call fails.

Bildschirmfoto 2019-08-20 um 13.39.55.png View - Screenshot of stacktrace (130 KB) Philipp Parzer, 2019-08-20 13:40


Related issues

Duplicated by TYPO3 Core - Bug #88997: Error: Cannot use object of type stdClass as array Closed 2019-08-22

Associated revisions

Revision 895d737f (diff)
Added by Andreas Fernandez 23 days ago

[BUGFIX] Set module state only if UC structure is intact

In some scenarios it seems the UC of a backend user is malformed and
isn't structured as expected. To circumvent this issue, the UC is
encoded to a JSON string and immediately decoded to a plain array again.

Resolves: #88984
Releases: master, 9.5
Change-Id: I9ebd382f5531bde1b872a75e02fb6fc4c93041ba
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61519
Tested-by: theline <>
Tested-by: Tobias Wollender <>
Tested-by: TYPO3com <>
Tested-by: Anja Leichsenring <>
Reviewed-by: theline <>
Reviewed-by: Oliver Klee <>
Reviewed-by: Frank Naegler <>
Reviewed-by: Anja Leichsenring <>

Revision 5d92c12e (diff)
Added by Andreas Fernandez 23 days ago

[BUGFIX] Set module state only if UC structure is intact

In some scenarios it seems the UC of a backend user is malformed and
isn't structured as expected. To circumvent this issue, the UC is
encoded to a JSON string and immediately decoded to a plain array again.

Resolves: #88984
Releases: master, 9.5
Change-Id: I9ebd382f5531bde1b872a75e02fb6fc4c93041ba
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61541
Tested-by: TYPO3com <>
Tested-by: Anja Leichsenring <>
Reviewed-by: Anja Leichsenring <>

History

#1 Updated by Gerrit Code Review 26 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61519

#2 Updated by Gerrit Code Review 26 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61519

#3 Updated by Gerrit Code Review 26 days ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61519

#4 Updated by Gerrit Code Review 24 days ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61519

#5 Updated by Guido Schmechel 24 days ago

  • Duplicated by Bug #88997: Error: Cannot use object of type stdClass as array added

#6 Updated by Riccardo De Contardi 24 days ago

I add here the description of issue #88997 to keep track of it:

After Updating from TYPO3 9.5.8 to 9.5.9 I get this error:

(1/1) Error

Cannot use object of type stdClass as array
in /_TYPO3-Sourcen/typo3_src-9.5.9/typo3/sysext/backend/Classes/Controller/BackendController.php line 254

        // Prepare the scaffolding, at this point extension may still add javascript and css
        $view = $this->getFluidTemplateObject($this->templatePath . 'Backend/Main.html');

        $collapseState = $this->getBackendUser()->uc['BackendComponents']['States']['typo3-module-menu']['collapsed'] ?? false;
        $view->assign('moduleMenuCollapsed', $collapseState === true || $collapseState === 'true');
        $view->assign('moduleMenu', $this->generateModuleMenu());
        $view->assign('topbar', $this->renderTopbar());

#7 Updated by Gerrit Code Review 23 days ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61541

#8 Updated by Andreas Fernandez 23 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF