Bug #89269

$GLOBALS['BE_USER']->uc sometimes wrongly written, gets a stdClass where an array would be expected

Added by Christian Eßl 5 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Start date:
2019-09-25
Due date:
% Done:

100%

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

Description

See issues:

https://forge.typo3.org/issues/88984
https://forge.typo3.org/issues/89268

It appears that since one of the latest patches (probalby 9.5.9), the uc is sometimes wrongly written and gets an stdClass where an array would be expected. This later leads to fatal errors because php expects an array, but gets an stdClass.
Both issues seem to be related to the pagetree / States and for now just fix the symptoms.

In #88984 it is the following setting that suddenly is an stdClass:
$this->getBackendUser()->uc['BackendComponents']['States']['typo3-module-menu']

In #89268 it is the key: (from javascript)
BackendComponents.States.Pagetree.stateHash.0_-1


Related issues

Related to TYPO3 Core - Bug #88984: Exception in BackendController 'Cannot use object of type stdClass as array' on $collapseState ( line 254 ) Closed 2019-08-20
Related to TYPO3 Core - Bug #89268: Cannot use object of type stdClass as array in BackendUserConfiguration.php Closed 2019-09-25
Related to TYPO3 Core - Bug #86398: Interface state can't be saved Closed 2018-09-27
Related to TYPO3 Core - Bug #89367: Revert introduction of new upgrade wizard Closed 2019-10-08
Related to TYPO3 Core - Bug #89638: BackendUserConfigurationUpdate Upgrade Wizard fails on empty UC fields Closed 2019-11-11

Associated revisions

Revision e8b5652d (diff)
Added by Christian Eßl 5 months ago

[BUGFIX] Provide UpgradeWizard for outdated be_users uc settings

Backend users each have a serialized array of individual user
configuration, called "uc" persisted in the be_users table.
Before TYPO3 9.5, the structure of this configuration could sometimes
contain stdClass objects, which is no longer supported. Logging in as
a backend user with such an outdated "uc" array would then crash several
parts of the TYPO3 backend, because the BackendUserConfiguration class
will try to access an stdClass type configuration like an array.

An UpgradeWizard called "BackendUserConfigurationUpdate" is now
provided, which allows to update any outdated "uc" structure of all
backend users.

Resolves: #89269
Resolves: #89268
Resolves: #86398
Releases: master, 9.5
Change-Id: I57c57e9e745cf5cabdc2f10d645816d3958e2a0d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61874
Tested-by: TYPO3com <>
Tested-by: Jörg Bösche <>
Tested-by: Daniel Goerz <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Daniel Goerz <>

Revision efbc7d8a (diff)
Added by Christian Eßl 4 months ago

[BUGFIX] Provide UpgradeWizard for outdated be_users uc settings

Backend users each have a serialized array of individual user
configuration, called "uc" persisted in the be_users table.
Before TYPO3 9.5, the structure of this configuration could sometimes
contain stdClass objects, which is no longer supported. Logging in as
a backend user with such an outdated "uc" array would then crash several
parts of the TYPO3 backend, because the BackendUserConfiguration class
will try to access an stdClass type configuration like an array.

An UpgradeWizard called "BackendUserConfigurationUpdate" is now
provided, which allows to update any outdated "uc" structure of all
backend users.

Resolves: #89269
Resolves: #89268
Resolves: #86398
Releases: master, 9.5
Change-Id: Ic2158b34e70c7f931f4ef8acc8c39af618e241e9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61906
Tested-by: TYPO3com <>
Tested-by: Daniel Goerz <>
Tested-by: Markus Klein <>
Tested-by: Tymoteusz Motylewski <>
Reviewed-by: Markus Klein <>
Reviewed-by: Daniel Goerz <>
Reviewed-by: Susanne Moog <>
Reviewed-by: Tymoteusz Motylewski <>

Revision b7a9e095 (diff)
Added by Christian Eßl 4 months ago

[BUGFIX] Provide UpgradeWizard for outdated be_users uc settings

Backend users each have a serialized array of individual user
configuration, called "uc" persisted in the be_users table.
Before TYPO3 9.5, the structure of this configuration could sometimes
contain stdClass objects, which is no longer supported. Logging in as
a backend user with such an outdated "uc" array would then crash several
parts of the TYPO3 backend, because the BackendUserConfiguration class
will try to access an stdClass type configuration like an array.

An UpgradeWizard called "BackendUserConfigurationUpdate" is now
provided, which allows to update any outdated "uc" structure of all
backend users.

Resolves: #89269
Resolves: #89268
Resolves: #86398
Releases: master, 9.5
Change-Id: Ic2158b34e70c7f931f4ef8acc8c39af618e241e9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62135
Tested-by: Tymoteusz Motylewski <>
Reviewed-by: Tymoteusz Motylewski <>

History

#1 Updated by Christian Eßl 5 months ago

  • Related to Bug #88984: Exception in BackendController 'Cannot use object of type stdClass as array' on $collapseState ( line 254 ) added

#2 Updated by Christian Eßl 5 months ago

  • Related to Bug #89268: Cannot use object of type stdClass as array in BackendUserConfiguration.php added

#3 Updated by Christian Eßl 5 months ago

  • Description updated (diff)

#4 Updated by Christian Eßl 5 months ago

  • Category set to Backend API

#5 Updated by Christian Eßl 5 months ago

After digging around the code in master a bit, I couldn't find a spot, where the uc array could possibly be filled with a stdClass structure instead of an array.

In my case, the errors described in #89268 happened after upgrading a TYPO3 instance from 7.6 to the latest 9.5.
  • Maybe the uc array previously could contain stdClass properties in older TYPO3 versions? I can't say that for sure
  • Can't rule out that the wrong configuration could previously have been filled by a third-party extensions and this has nothing to do with the core.

Found another related ticket describing the same problems:
https://forge.typo3.org/issues/86398

I had the same error. It seems to occur when upgrading an old TYPO3 installation to 9.5. It was concerning only existing users - new users didn't have this problem. I suppose the reason is in the structure of the serialized array in be_users.uc. There might have been some structural changes.

My solution was quite simple: User Settings -> Edit and Advanced functions -> Reset user settings to default state.
Then the user config data is written new and the system can use it.

Maybe there coud be provided an upgrade wizard for this...

Looks like my guess with the structural changes in the uc array between versions could be right? Then maybe the fix in #89268 would be the wrong approach and an Upgrade Wizard that updates the uc structure for all backend users would be the right approach to fix this.
What do you think?

#6 Updated by Christian Eßl 5 months ago

  • Related to Bug #86398: Interface state can't be saved added

#7 Updated by Gerrit Code Review 5 months 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/+/61874

#8 Updated by Gerrit Code Review 5 months 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/+/61874

#9 Updated by Gerrit Code Review 5 months 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/+/61916

#10 Updated by Daniel Goerz 5 months ago

  • Related to Bug #89367: Revert introduction of new upgrade wizard added

#11 Updated by Christian Eßl 5 months ago

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

#12 Updated by Gerrit Code Review 5 months ago

  • Status changed from Resolved 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/+/61906

#13 Updated by Gerrit Code Review 5 months 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/+/61906

#14 Updated by Gerrit Code Review 5 months 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/+/61906

#15 Updated by Gerrit Code Review 5 months 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/+/61906

#16 Updated by Gerrit Code Review 5 months ago

Patch set 5 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/+/61906

#17 Updated by Gerrit Code Review 5 months ago

Patch set 6 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/+/61906

#18 Updated by Gerrit Code Review 4 months ago

Patch set 7 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/+/61906

#19 Updated by Gerrit Code Review 4 months 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/+/62135

#20 Updated by Christian Eßl 4 months ago

  • Status changed from Under Review to Resolved

#21 Updated by Daniel Goerz 4 months ago

  • Related to Bug #89638: BackendUserConfigurationUpdate Upgrade Wizard fails on empty UC fields added

#22 Updated by Benni Mack 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF