Bug #76406
closedUser settings reset with addToList ajax call
100%
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
Updated by Daniel Goerz over 8 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:- Create a Category and at least one subcategory
- Open a content element and go to categories tab
- Oben and/or close the category tree
- save
- Now your user settings are blank (e.g. you dont have an RTE anymore)
Updated by Gerrit Code Review over 8 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
Updated by Daniel Goerz over 8 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.
Updated by Daniel Goerz over 8 years ago
- Status changed from Accepted to Under Review
Updated by Marco Bresch over 8 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.
Updated by Daniel Goerz over 8 years ago
Updated Reproduce-Steps:
- Create a new backend user (with admin flag or sufficient rights to edit content and categories)
- Login to the backend with the newly created backend user
- Create a Category and at least one subcategory
- Open a content element with an RTE field and go to categories tab
- Open and close the category tree (this is where the AJAX requests are triggered)
- Save
- Now your user settings are broken
- Switch to general tab. The RTE is gone.
Updated by Gerrit Code Review over 8 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
Updated by Daniel Goerz over 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 700d36aca74b6eb91e6f610ba9b93dc68acc06fa.