Issue Bug Closed

#76406User settings reset with addToList ajax call

Markus Blaschke 05/31/16, 17:21 updated 10/02/18, 11:10

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

Reviews 2