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 #1

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:
  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)
Actions #2

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

Actions #3

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.

Actions #4

Updated by Daniel Goerz over 8 years ago

  • Status changed from Accepted to Under Review
Actions #5

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.

Actions #6

Updated by Daniel Goerz over 8 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.
Actions #7

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

Actions #8

Updated by Daniel Goerz over 8 years ago

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

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF