Review main Merged

93726[BUGFIX] Fix double JSON encoding of backend user settings

Stefan Bürk CR +2 V +2 Hard +357 −56 updated 04/21/26, 11:57

Commit message

Since #108832, backend user settings are stored as JSON in `be_users`.
A redundant manual `json_encode()` call caused values to be persisted
double-encoded instead of storing the raw JSON object.

This went undetected because `UserSettingsMigration` and its functional
tests were written to compensate: the tests asserted against
double-encoded values and decoded twice on read, effectively masking
the root cause rather than catching it.

To fix this properly, settings are now passed as plain PHP array to
`Connection::update()`, letting Doctrine's JSON type handle encoding.
This removes all manual `json_encode()` calls, eliminates the need for
double-decoding, and corrects the tests to reflect the intended behavior.

Additionally, new user settings are now `json_encode()`d to the internal
`BackendUserAuthentication` user record to ensure recreated settings use
updated values instead of persisted ones.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 5

Review log 2030

Show 35 earlier messages
  1. Stefan Bürk uploaded patch set 1 04/17/26, 22:06

  2. core-ci voted on patch set 1 V +1 04/17/26, 22:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100419

  3. Stefan Bürk uploaded patch set 2 V +1 04/17/26, 22:33

  4. Stefan Bürk updated the commit message in patch set 3 04/17/26, 22:34

  5. core-ci voted on patch set 2 V +1 04/17/26, 23:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100422

  1. core-ci voted on patch set 3 V +1 04/17/26, 23:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100423

  2. Anja Leichsenring updated the commit message in patch set 4 V +1 04/18/26, 04:11

  3. core-ci voted on patch set 4 V -1 04/18/26, 04:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100435

  4. core-ci commented on patch set 4 04/18/26, 09:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100435

  5. core-ci voted on patch set 4 V +1 04/18/26, 11:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100435

  6. Stefan Bürk updated the commit message in patch set 5 V +1 04/19/26, 10:16

  7. Stefan Bürk marked it ready for review 04/19/26, 10:16

  8. core-ci voted on patch set 5 V +1 04/19/26, 10:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100476

  9. Oliver Klee voted on patch set 5 V +1 04/19/26, 11:13

  10. Garvin Hicking voted on patch set 5 CR +1 V +1 04/20/26, 07:08

  11. Christian Kuhn uploaded patch set 6 CR +1 V +1 04/20/26, 10:49

  12. Christian Kuhn commented on patch set 6 V -1 04/20/26, 10:52

    with applied patch, changing 'email me at login' state is not reflected after 'save' anymore, but only after new-call to module.
  13. core-ci voted on patch set 6 V +1 04/20/26, 10:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100546

  14. Stefan Bürk commented on patch set 6 04/20/26, 11:01

    Reply

    Thanks lolli. Looking into it.
  15. Stefan Bürk uploaded patch set 7 V +1 04/20/26, 14:16

  16. Stefan Bürk commented on patch set 7 04/20/26, 14:19

    Reply

    Should be fixed now by setting it additionally `json_encode()` to the internal user record used to populate a new UserSettings object within the same request, for example to display it.
  17. core-ci voted on patch set 7 V -1 04/20/26, 14:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100570

  18. Stefan Bürk uploaded patch set 8 V -1 04/20/26, 15:23

  19. core-ci voted on patch set 8 V +1 04/20/26, 15:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100577

  20. Garvin Hicking commented on patch set 8 CR +1 V +1 04/20/26, 15:34

    Reply

    This works now! I only tested the "Personalization" checkboxes sadly, but could reproduce this and verify the fix.
  21. Oliver Hader voted on patch set 8 CR +1 V +1 04/20/26, 16:03

  22. Stefan Bürk voted on patch set 8 CR +2 V +2 04/20/26, 16:14

  23. Stefan Bürk merged patch set 9 04/20/26, 16:14

  24. Benjamin Franzke commented on patch set 9 04/21/26, 10:23

    UserSettingsMigration.php:80

    I think this caused a regression, upgrading a v13 user UC to a v14 instance causes a "PHP Warning: Array to string conversion" for me, see https://forge.typo3.org/issues/109662
  25. Benjamin Franzke commented on patch set 9 04/21/26, 11:57

    UserSettingsMigration.php:80 Reply

    Sorry, probably related to an unsupported MariaDB version on the instance that I tried to upgrade. (will report back if not)