Project

General

Profile

Actions

Bug #76406

closed

User settings reset with addToList ajax call

Added by Markus Blaschke over 8 years ago. Updated about 6 years ago.

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

100%

Estimated time:
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 1 (0 open1 closed)

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

Actions
Actions

Also available in: Atom PDF