Review main Merged

94809[TASK] Avoid unset() on protected class properties

Benni Mack CR +2 V +2 Easy +1 −2 updated 07/17/26, 14:34

Commit message

PHP 8.4 introduced property hooks. A subclass may redeclare an
inherited non-private property and attach hooks to it. Calling
unset() on such a property then throws a runtime Error
("Cannot unset hooked property"), which makes unset() on any
protected property of a non-final class a latent crash.

PHPStan reports this as "unset.possiblyHookedProperty" when
analyzing with phpVersion 8.4 or higher.

The affected places reset the property to its default value
right away anyway, so the unset() calls can safely be replaced
by plain default value assignments.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benni Mack +2
    • Benjamin Franzke +1
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 89

  1. Benni Mack uploaded patch set 1 07/17/26, 10:17

  2. Benjamin Franzke voted on patch set 1 CR +1 07/17/26, 10:24

  3. core-ci voted on patch set 1 V +1 07/17/26, 10:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/104872

  4. Benni Mack marked it ready for review 07/17/26, 10:33

  5. Andreas Kienast voted on patch set 1 CR +1 07/17/26, 10:36

  6. Benjamin Franzke voted on patch set 1 V +1 07/17/26, 10:45

  7. Stefan Bürk voted on patch set 1 CR +1 V +1 07/17/26, 13:54

  8. Benni Mack voted on patch set 1 CR +2 V +2 07/17/26, 14:34

  9. Benni Mack merged patch set 2 07/17/26, 14:34