Review main Merged Breaking

96825[!!!][TASK] Use __serialize() and __unserialize() instead of __sleep()

Benni Mack CR +2 V +2 Hard +391 −75 updated 10/23/26, 05:06

Commit message

PHP 8.5 deprecates the magic methods __sleep() and __wakeup() in
favor of __serialize() and __unserialize(). All Core classes are
migrated at once.

Since AbstractDomainObject implements __serialize() and
__unserialize(), PHP no longer called __sleep() and __wakeup() of
PseudoFileReference, which exposed the complete object including
internal identifiers in the serialized form state. The migration
restores the intended payload, containing only the uid.

The DenyListDeserializer now also rejects classes with a
user-defined __unserialize() method, as it is an entry point for
deserialization gadgets just like __wakeup().

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Wouter Wolters +1
    • Alexander Schnitzler +1
  • Verified V +2 Done
    • Benni Mack +2
    • Georg Ringer +1
    • Wouter Wolters +1
    • Alexander Schnitzler +1
    • core-ci +1 CI

Issues 1

Files 17

Review log 89

  1. Benni Mack uploaded patch set 1 10/18/26, 14:49

  2. core-ci voted on patch set 1 V +1 10/18/26, 14:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111536

  3. Benni Mack marked it ready for review 10/18/26, 16:24

  4. Wouter Wolters voted on patch set 1 CR +1 V +1 10/18/26, 20:29

  5. Alexander Schnitzler voted on patch set 1 CR +1 V +1 10/20/26, 07:26

  6. Alexander Schnitzler commented on patch set 1 10/20/26, 07:27

    Thanks, looks good to me. All remaining __sleep()/__wakeup() in Core are gone. The new tests fail without the production change (PseudoFileReferenceTest, DenyListDeserializerTest::classWithUnserializeIsBlocked), so they really cover the regression from the native lazy objects change and the new deny rule. 1) Wording: PHP 8.5 only soft-deprecates __sleep()/__wakeup() (UPGRADING: "have been soft-deprecated", no E_DEPRECATED is emitted). Please say "soft-deprecates" in the commit message and the RST, otherwise readers expect deprecation notices on 13.4/14.3 and ask for backports. 2) Optional: Logger is allowed in the deserializer exactly for old payloads (scheduler tasks), but Logger::__unserialize() does not read the name from data written by the former __sleep(), which carries the mangled key "\0*\0name": - $this->name = (string)($data['name'] ?? ''); + $this->name = (string)($data['name'] ?? $data["\0*\0name"] ?? ''); 3) Optional (RST): the migration example names Extbase models as the main case but does not call parent::__serialize()/__unserialize(). Applied to an entity as is, uid/pid would be lost. A hint or a second example would help.
  7. Georg Ringer voted on patch set 1 CR +1 V +1 10/22/26, 20:49

  8. Benni Mack voted on patch set 1 CR +2 V +2 10/23/26, 05:05

  9. Benni Mack merged patch set 2 10/23/26, 05:06