Bug #76406
closed
User settings reset with addToList ajax call
Added by Markus Blaschke over 8 years ago.
Updated about 6 years ago.
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
- 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)
- Status changed from Accepted to Under Review
- 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.
- Status changed from Accepted to Under Review
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 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.
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF