Review main Merged

93826[TASK] Clarify package cache identifier generation test

Helmut Hummel CR +2 V +2 Easy +26 −5 updated 04/24/26, 06:21

Commit message

The explanation introduced in
https://review.typo3.org/c/Packages/TYPO3.CMS/+/93749
puts too much emphasis on the 1-second resolution of file mtime.

That is not the relevant part of the observed failure.

In TYPO3 classic mode, PackageStates.php is typically rewritten only
once per operation. The problem is therefore not that the file is
modified multiple times within a single second, but that PHP may return
cached stat metadata for the same file within the same request.

If file metadata has already been read once and the file is rewritten
later in that request, a subsequent filemtime() or stat() call can still
return the previously cached values unless clearstatcache() is called.
In that situation, extending the cache identifier from mtime to
mtime+filesize does not help, because both values are served from the
same stale stat cache entry.

The relevant fix is clearing PHP's stat cache when invalidating the
cached identifier. Combining mtime and filesize is, at most, an
additional safeguard once fresh metadata is actually retrieved.

Adjust the unit test accordingly: instead of simulating a rewrite within
the same mtime second, model the actual failure mode more directly by

- setting mtime from an existing `PackageStates.php` file to a time in the past,
- modifying that file later in the same request,
- asserting that a different identifier is generated after invalidation.

This makes it explicit that the decisive behavior is stat cache
invalidation, not timestamp granularity.

But also add a second test, that explicitly changes the `PackageStates.php`
file within one second and verify, that we still get a different identifier
from that.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Garvin Hicking +1
    • Stefan Bürk +1
    • Christian Kuhn +1
    • Josua Vogel +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Oliver Klee +1
    • Garvin Hicking +1
    • Stefan Bürk +1
    • Christian Kuhn +1
    • Josua Vogel +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 89

  1. Helmut Hummel uploaded patch set 1 04/23/26, 12:07

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

  3. Oliver Klee voted on patch set 1 V +1 04/23/26, 13:01

  4. Christian Kuhn voted on patch set 1 CR +1 V +1 04/23/26, 16:02

  5. Garvin Hicking voted on patch set 1 CR +1 V +1 04/23/26, 16:16

  6. Josua Vogel voted on patch set 1 CR +1 V +1 04/23/26, 16:32

  7. Stefan Bürk voted on patch set 1 CR +1 V +1 04/23/26, 20:20

  8. Helmut Hummel voted on patch set 1 CR +2 V +2 04/24/26, 06:21

  9. Helmut Hummel merged patch set 2 04/24/26, 06:21