Review main Merged

75534[BUGFIX] Avoid invalid property access when persisting extbase objects

Stefan Bürk CR +2 V +2 Easy +28 −5 updated 08/24/22, 11:04

Commit message

With #95819 the detection of Domain Object properties was changed to use
ClassSchema in order to support uninitialized properties is models.
This was not possible with `DomainObjectInterface::_getProperties()`
which used `get_object_vars()` under the hood.

However, with mentioned change, other properties which had been
ignored by `get_object_vars()` were now propagated to persistence,
even if those properties were not configured in TCA. The change in
behavior is considered a regression and is now addressed:

The retrieval of the property value is delayed until after it is
ensured that the property is a persistable property (which asserts
that we are not reading from private properties).

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Benjamin Franzke +1
    • Alexander Schnitzler +1
    • Moritz Ngo +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Benjamin Franzke +1
    • Alexander Schnitzler +1
    • Moritz Ngo +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 3

Review log 3241

Show 1216 earlier messages
  1. Stefan Bürk uploaded patch set 1 08/22/22, 20:41

  2. Stefan Bürk uploaded patch set 2 08/22/22, 20:46

  3. core-ci voted on patch set 1 V -1 08/22/22, 20:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30363

  4. core-ci voted on patch set 2 V +1 08/22/22, 20:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30364

  5. Stefan Bürk wrote 08/22/22, 20:54

    Topic set to EXT: extbase
  6. Stefan Bürk wrote 08/22/22, 20:54

    Topic EXT: extbase removed
  7. Stefan Bürk wrote 08/22/22, 20:54

    Topic set to EXT: extbase
  8. Stefan Bürk uploaded patch set 3 08/22/22, 20:59

  9. core-ci voted on patch set 3 V +1 08/22/22, 21:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30365

  10. Oliver Hader commented on patch set 3 08/23/22, 05:48

    Backend.php:915

    I guess this one also needs to be moved after the `$columnMap === null` check...
  11. Oliver Hader commented on patch set 3 08/23/22, 05:56

  12. Stefan Bürk commented on patch set 3 08/23/22, 07:38

    Reply

    > https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005/21/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php#386 (move to `if` block) ack. > https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005/21/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php#578 (e.g. filtering `getProperties()` for non-private properties as well?) Not sure on this - I would tend to no. This has been the same as before. If getProperties() filter's this out in the same way, the "getDomainObjectProperties()" method is superflous then - this was introduced to reflect the DomainObject->_getProperties() filter behaviour.

    Backend.php:915 Reply

    ack. Totally oversaw the change in this method.
  13. Oliver Hader uploaded patch set 4 08/23/22, 09:21

  14. Oliver Hader commented on patch set 4 08/23/22, 09:21

    Backend.php:915 Reply

    Done
  15. core-ci voted on patch set 4 V +1 08/23/22, 09:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30370

  16. Oliver Hader uploaded patch set 5 08/23/22, 12:28

  1. core-ci voted on patch set 5 V -1 08/23/22, 12:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30376

  2. Oliver Hader uploaded patch set 6 08/23/22, 12:39

  3. Oliver Hader updated the commit message in patch set 7 08/23/22, 12:46

  4. core-ci voted on patch set 6 V +1 08/23/22, 12:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30377

  5. Moritz Ngo commented on patch set 7 08/23/22, 12:47

    DummyEntity.php:26

    Should we add a private property to this DummyEntity and make sure that all unit tests are still running fine?
  6. core-ci voted on patch set 7 V +1 08/23/22, 12:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30378

  7. Oliver Hader commented on patch set 7 V +1 CR +1 08/23/22, 13:03

    Looks good from my side... still pending for more detailed reviews & tests.
  8. Stefan Bürk commented on patch set 7 08/23/22, 15:44

    Reply

    Done

    Reply

    Thanks Oliver for taking care of the rest. +1 with the changes. Retested on my side and this should be fine. Still needs more verification and reviewer.
  9. Oliver Hader commented on patch set 7 08/23/22, 15:51

    DummyEntity.php:26 Reply

    Unit tests unfortunately are not invoking all required components for persisting changes. Recent patch-set 7 tests for private and public static properties via @DateTimeImmutableExample@ in @\TYPO3\CMS\Extbase\Tests\Functional\Persistence\Generic\Mapper\DataMapperTest@
  10. Oliver Hader commented on patch set 7 08/23/22, 15:53

    Alex, in case you have time, your feedback/review would be highly appreciated here. Thanks in advance!
  11. Alexander Schnitzler commented on patch set 7 08/23/22, 17:46

    Reply

    I will review tomorrow.
  12. Markus Klein updated the commit message in patch set 8 08/23/22, 18:02

  13. Markus Klein voted on patch set 8 CR +1 08/23/22, 18:04

  14. core-ci voted on patch set 8 V +1 08/23/22, 18:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30384

  15. Oliver Hader voted on patch set 8 V +1 CR +1 08/23/22, 18:51

  16. Benjamin Franzke updated the commit message in patch set 9 08/23/22, 19:10

  17. Benjamin Franzke voted on patch set 9 V +1 08/23/22, 19:16

  18. Benjamin Franzke wrote 08/23/22, 19:17

    Topic EXT: extbase removed
  19. Benjamin Franzke wrote 08/23/22, 19:17

    Topic set to extbase
  20. core-ci voted on patch set 9 V +1 08/23/22, 19:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30388

  21. Moritz Ngo voted on patch set 9 V +1 CR +1 08/24/22, 05:20

  22. Alexander Schnitzler commented on patch set 9 V +1 CR +1 08/24/22, 08:00

    I think this is a valid regression fix but I'd still like to mention, that we have an issue with Extbase, providing a @Transient annotation which doesn't actually do anything. My preferred way to handle this in the future is to have people use that annotation and don't look at the TCA to determine if a property should be persisted. Anyway, that's something for another day. Thanks for taking care.
  23. Oliver Hader voted on patch set 9 V +1 CR +1 08/24/22, 08:01

  24. Stefan Bürk voted on patch set 9 V +2 CR +2 08/24/22, 10:41

  25. Stefan Bürk merged patch set 10 08/24/22, 11:04