Review main Ready for review Stale

93162[BUGFIX] Treat NULL as valid cache entry in `TransientMemoryBackend`

Elias Häußler CR 0 V -1 Easy +8 −6 updated 06/18/26, 23:04

Commit message

The `TransientMemoryBackend` is used for runtime caches; cache entries
are stored in a plain key-value array, making each cache entry available
during runtime. Cache entries are not limited to a specific type –
instead, the `TransientMemoryBackend` is capable of storing all possible
values as long as they can be assigned to an array.

With the previous implementation of this cache backend, cache entries
resolving to a stored NULL value were improperly treated as "not
available": Calling the `has()` and `get()` methods both returned false
instead of `true` and `null`, respectively. Since NULL values may still
transport relevant information to consumers, the underlying array
accesses have been adapted to treat NULL values the same way other
values are handled. The relevant change is to use `array_key_exists()`
over `isset()`, which is way more precise in this situation.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 3
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/62/93162/3 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/62/93162/3 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V -1 Blocked
    • core-ci -1 CI

Issues 1

Files 1

Review log 610

  1. Elias Häußler uploaded patch set 1 03/12/26, 13:58

  2. Elias Häußler updated the commit message in patch set 2 03/12/26, 14:01

  3. core-ci voted on patch set 1 V +1 03/12/26, 14:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97830

  4. core-ci voted on patch set 2 V -1 03/12/26, 14:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97831

  5. core-ci voted on patch set 2 V +1 03/12/26, 14:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97831

  6. Garvin Hicking commented on patch set 2 03/12/26, 21:24

    Unresolved

    I think this is so low level that we should cover this with a regression test, wdyt?
  7. Christian Kuhn commented on patch set 2 03/13/26, 08:12

    Unresolved

    iirc 'null vs. cache-entry-does-not-exist' is an issue since day 1 that should be reviewed and solved in all backends. i think 'false' as cache value is an issue, too. i'm unsure if solving this for transientBE only will help us that much and i fear we should rather try to do that systematically. at least for some backends, it might be required to store a simple DTO instead - it might be the only solution to force a clean distinction between 'yes, we have a cache entry with whatever value' and 'no, there isn't' - even if the array-key solution with transientBackend would probably work here. I think at least one of the PSR cache interfaces also returns a DTO (didn't look that up again), which is one of the clever things they did, so if we start storing (serialized?) DTO's, we may want to look if we could align this and wire it into the frontends as well to receive (partial?) PSR-compat along the way. We can also very well decide to do this change for transient only as proposed, and walk away, but that probably only one piece of the cake.
  8. Benni Mack updated the commit message in patch set 3 V +1 04/22/26, 06:43

  9. core-ci voted on patch set 3 V -1 04/22/26, 10:37 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100773

  10. Christian Kuhn wrote 06/18/26, 23:04

    Removed cc Christian Kuhn.