Review main Merged

73975[BUGFIX] Fix serialization of LazyLoadingProxy and LazyObjectStorage

Alexander Schnitzler CR +2 V +2 Normal +182 −5 updated 05/14/25, 07:35

Commit message

Due to the dependency of those objects to the DataMapper and its own
dependency chain, serialization of those objects lead to error:

Serialization of \Closure not allowed.

To ommit this issue and to reduce the footprint of the serialization
data in general, the data mapper should be omitted and reinitialized
via __serialize() and __unserialize()

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Christian Kuhn +1
    • Benni Mack +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Christian Kuhn +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 5

Review log 4657

Show 2532 earlier messages
  1. Alexander Schnitzler uploaded patch set 1 03/16/22, 09:40

  2. Alexander Schnitzler wrote 03/16/22, 09:40

    Topic set to extbase
  3. core-ci voted on patch set 1 V +1 03/16/22, 09:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24939

  4. Sebastian Sebastian updated the commit message in patch set 2 03/16/22, 21:04

  5. core-ci voted on patch set 2 V +1 03/16/22, 21:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24953

  6. Alexander Schnitzler commented on patch set 2 03/31/22, 12:42

    This change is ready for review.
  7. Oliver Klee voted on patch set 2 CR +1 03/31/22, 14:18

  8. Oliver Klee updated the commit message in patch set 3 03/31/22, 14:19

  9. Oliver Klee voted on patch set 3 CR +1 03/31/22, 14:19

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

  11. Susi Moog voted on patch set 3 CR +1 04/04/22, 14:12

  12. Stefan Bürk commented on patch set 3 07/07/22, 20:28

    master => main Just asking ... should we really relay on the "old way" magic methods ? Or should we not better use the more newer and higher priorized "serialize()/unserialize()" methods adding to the classes, with corresponding \Serializeable interface for 11.5 and additionally corresponding __serialize/__unserialize methods on 10.4 ? (10.4 at all ?)
  13. Oliver Klee commented on patch set 3 CR 0 07/08/22, 09:32

    We should also cover this with tests. I can do that, but it might take some time.
  14. Oliver Klee commented on patch set 3 07/08/22, 10:29

    Reply

    I'm all for using modern things (in this case: the interface), and AFAICS that wouldn't be breaking, i.e., we could also backport this to 10.4 without significant changes.
  15. Alexander Schnitzler rebased onto patch set 4 07/31/22, 08:35

  16. core-ci voted on patch set 4 V +1 07/31/22, 08:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29741

  17. Oliver Klee voted on patch set 4 CR +1 07/31/22, 09:20

  18. Alexander Schnitzler uploaded patch set 5 07/31/22, 09:33

  19. Oliver Klee voted on patch set 5 CR +1 07/31/22, 09:35

  20. core-ci voted on patch set 5 V +1 07/31/22, 09:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29743

  21. Oliver Klee voted on patch set 5 V +1 07/31/22, 09:41

  22. Oliver Klee commented on patch set 5 CR 0 07/31/22, 10:00

    LazyObjectStorage.php:324

    Should we also update these calls (and cover thee with tests)?
  23. Alexander Schnitzler uploaded patch set 6 07/31/22, 10:02

  24. Alexander Schnitzler commented on patch set 6 07/31/22, 10:04

    LazyObjectStorage.php:324 Reply

    Done
  25. Alexander Schnitzler commented on patch set 6 07/31/22, 10:06

    FYI: I didn't implement \Serializable as I understand this interface is kind of deprecated or at least their methods serialize/unserialize in favor of the PHP 7.4+ magic methods __serialize/__unserialize. Not sure if I understand the direction, PHP goes into, completely.
  26. core-ci voted on patch set 6 V -1 07/31/22, 10:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29744

  27. Alexander Schnitzler commented on patch set 6 07/31/22, 10:16

    One question remains: If a LazyObjectStorage is already initialized, it pretty much acts as a regular ObjectStorage, containing not only the parent object for internal resolval but also all resolved objects. We could further reduce the footprint here by not serializing resolved objects and unserialize with a fresh state being: - storage - isModified - addedObjectsPositions - removedObjectsPositions - positionCounter - isInitialized reset to their default values. I am not sure yet if that is a good or bad idea. I guess it depends heavily on the circumstances those LazyObjectStorages are serialized.
  28. Alexander Schnitzler uploaded patch set 7 07/31/22, 10:32

  29. Oliver Klee commented on patch set 7 07/31/22, 10:46

    LazyObjectStorage.php:328

    We can combine these two into one unset call.
  30. Oliver Klee commented on patch set 7 07/31/22, 10:47

    Reply

    Makes sense. I’d prefer to move that optimization out of this bug fix, though, into a separate change.
  31. core-ci voted on patch set 7 V +1 07/31/22, 10:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29749

  32. Alexander Schnitzler commented on patch set 7 07/31/22, 10:51

    Reply

    Ack
  1. Alexander Schnitzler commented on patch set 8 07/31/22, 11:02

    Published edit on patch set 7.
  2. core-ci voted on patch set 8 V +1 07/31/22, 11:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29752

  3. Oliver Klee commented on patch set 8 V +1 CR +1 07/31/22, 11:16

    LazyObjectStorage.php:328 Reply

    Done
  4. Alexander Schnitzler commented on patch set 7 07/31/22, 12:47

    Reply

    Done

    Reply

    Done
  5. Simon Schaufelberger voted on patch set 8 V +1 CR +1 08/03/22, 16:34

  6. Oliver Hader voted on patch set 8 CR +1 11/07/22, 20:15

  7. Benni Mack updated the commit message in patch set 9 11/07/22, 22:43

  8. Benni Mack voted on patch set 9 CR +1 11/07/22, 22:43

  9. Benni Mack voted on patch set 9 V +1 11/07/22, 22:45

  10. core-ci voted on patch set 9 V -1 11/07/22, 22:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33266

  11. Stefan Bürk rebased onto patch set 10 11/08/22, 10:14

  12. Christian Kuhn voted on patch set 10 CR +1 11/08/22, 10:25

  13. core-ci voted on patch set 10 V -1 11/08/22, 10:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33287

  14. Christian Kuhn commented on patch set 10 CR -1 11/08/22, 10:28

    on it.
  15. Christian Kuhn uploaded patch set 11 11/08/22, 10:31

  16. Christian Kuhn voted on patch set 11 V +1 CR +1 11/08/22, 10:33

  17. Oliver Klee voted on patch set 11 CR +1 11/08/22, 10:36

  18. core-ci voted on patch set 11 V +1 11/08/22, 10:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/33290

  19. Benni Mack voted on patch set 11 V +1 CR +1 11/08/22, 10:41

  20. Stefan Bürk voted on patch set 11 V +2 CR +2 11/08/22, 10:48

  21. Stefan Bürk merged patch set 12 11/08/22, 10:48

  22. Oliver Hader commented on patch set 12 11/08/22, 10:49

    LazyObjectStorage.php:336

    Note for a future follow-up on the PHP 8.2 dynamic property handling: Check existence of corresponding property before setting it. This can happen when data is unserialized in a changed code-base (e.g. property has been removed in between).
  23. Benjamin Franzke commented on patch set 12 11/08/22, 11:02

    Unresolved

    I don't think that this patch fixes the issue described in https://forge.typo3.org/issues/92148 – that one is about injected repositories, not about proxies.
  24. Alexander Schnitzler commented on patch set 12 02/19/23, 08:34

    LazyObjectStorage.php:336 Reply

    Thanks for the hint, can we achieve this with just `property_exists` here?
  25. Oliver Hader commented on patch set 12 05/14/25, 07:35

    LazyObjectStorage.php:336 Reply

    I finally created a patch for that at https://review.typo3.org/c/Packages/TYPO3.CMS/+/89384