Review main Ready for review

97806[BUGFIX] Empty ObjectStorage when removeAll() gets itself

Oli Bartsch CR 0 V 0 Easy +34 −1 updated 11/18/26, 21:11

Commit message

ObjectStorage iterates using the internal pointer of its own storage
array. removeAll() walked the given storage with foreach and detached
every yielded object. When the given storage is the storage itself,
each detach() unsets the element the pointer stands on, PHP moves the
pointer to the next element, and the next() of foreach then skips it.
As a result only every other object was removed.

removeAll() now iterates over a snapshot of the given storage taken
with toArray(), so detaching objects no longer interferes with the
iteration. LazyObjectStorage gets the fix through parent::removeAll().

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 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/06/97806/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/06/97806/1 && git cherry-pick FETCH_HEAD

Review

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

Merge conflicts 1

Issues 1

Files 2

Review log 12

  1. Oli Bartsch uploaded patch set 1 11/18/26, 21:03

  2. core-ci voted on patch set 1 V +1 11/18/26, 21:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114926