Bug #76406

User settings reset with addToList ajax call

Added by Markus Blaschke over 3 years ago. Updated 12 months ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
-
Target version:
Start date:
2016-05-31
Due date:
% Done:

100%

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

Description

All BE_USER settings (of the current user) are cleared if one sub tree in categories is opened by the current user.

In UserSettingsController within getFromDottedNotation $array is a reference to $BE_USER->uc which is reset to [] if the key is not found:

inside vendor/typo3/cms/typo3/sysext/backend/Classes/Controller/UserSettingsController.php:

        $array = &$this->getBackendUser()->uc;
        foreach ($subkeys as $subkey) {
            if (isset($array[$subkey])) {
                $array =  &$array[$subkey];
            } else {
                $array = [];
                break;
            }
        }

which should be:

        $array = &$this->getBackendUser()->uc;
        foreach ($subkeys as $subkey) {
            if (isset($array[$subkey])) {
                $array =  &$array[$subkey];
            } else {
                unset($array);
                $array = []
                break;
            }
        }

or

        $array = &$this->getBackendUser()->uc;
        foreach ($subkeys as $subkey) {
            if (!isset($array[$subkey])) {
                $array[$subkey] = [];
           }
            $array =  &$array[$subkey];
        }

to keep the reference and the return value the same if the key doesn't exists


Related issues

Related to TYPO3 Core - Bug #71315: router - PHP Warning: Creating default object from empty value Closed 2015-11-04

Associated revisions

Revision 700d36ac (diff)
Added by Daniel Goerz over 3 years ago

[BUGFIX] Prevent reset of user settings in getFromDottedNotation()

Change-Id: Idd9bd02e81ffb5b3ed02f5bf47d6fa3a9be7cdbd
Resolves: #76406
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/48426
Reviewed-by: Markus Blaschke <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>

Revision 8a5d9842 (diff)
Added by Daniel Goerz over 3 years ago

[BUGFIX] Prevent reset of user settings in getFromDottedNotation()

Change-Id: Idd9bd02e81ffb5b3ed02f5bf47d6fa3a9be7cdbd
Resolves: #76406
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/48563
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>

History

#1 Updated by Daniel Goerz over 3 years ago

  • Status changed from New to Accepted
  • Assignee set to Daniel Goerz
  • Priority changed from Should have to Must have
  • Target version set to next-patchlevel
  • TYPO3 Version changed from 7 to 8
  • Is Regression changed from No to Yes

Nasty thing.

Reproduce:
  1. Create a Category and at least one subcategory
  2. Open a content element and go to categories tab
  3. Oben and/or close the category tree
  4. save
  5. Now your user settings are blank (e.g. you dont have an RTE anymore)

#2 Updated by Gerrit Code Review over 3 years ago

  • Status changed from Accepted 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/48426

#3 Updated by Daniel Goerz over 3 years ago

  • Status changed from Under Review to Accepted

Create a new BE user for this or empty the uc field in the database for your user.

#4 Updated by Daniel Goerz over 3 years ago

  • Status changed from Accepted to Under Review

#5 Updated by Marco Bresch over 3 years ago

I tried to reproduce this bug but my master is working fine without this patch. I only noticed that the category-tree is still expanded after saving. But this behavior is the same with and without the patch.

#6 Updated by Daniel Goerz over 3 years ago

Updated Reproduce-Steps:

  1. Create a new backend user (with admin flag or sufficient rights to edit content and categories)
  2. Login to the backend with the newly created backend user
  3. Create a Category and at least one subcategory
  4. Open a content element with an RTE field and go to categories tab
  5. Open and close the category tree (this is where the AJAX requests are triggered)
  6. Save
  7. Now your user settings are broken
  8. Switch to general tab. The RTE is gone.

#7 Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48563

#8 Updated by Daniel Goerz over 3 years ago

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

#9 Updated by Benni Mack 12 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF