Review main Merged

84000[BUGFIX] Properly handle diff while updating meta data

Daniel Siepmann CR +2 V +2 Normal +56 −1 updated 04/23/24, 18:59

Commit message

The existing solution using `array_diff` did not work, as it only
respects values, not a combination with keys.

Given an existing record with some empty values would prevent unsetting
another value with an empty. The same would apply for setting another
value to an existing value.

That's why we change to `array_diff_assoc`, which handles proper diff of
value in combination with key.

Review

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

Issues 1

Files 3

Review log 1622

  1. Daniel Siepmann uploaded patch set 1 04/23/24, 09:44

  2. core-ci voted on patch set 1 V +1 04/23/24, 09:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56558

  3. Christian Kuhn commented on patch set 1 04/23/24, 13:09

    feels as if this change could benefit from a functional test: update() is public and looks as if it's easily testable? this gives us the opportunity to see a "fails without subject change", "good with subject change", and would make the commit message more clear along the way.
  4. Oliver Klee updated the commit message in patch set 2 V +1 04/23/24, 13:13

  5. Daniel Siepmann commented on patch set 1 04/23/24, 13:18

    Reply

    Thought so as well. But unit tests seemed to be a bigger deal because it also fetches the info and creates several classes via makeInstance. Also, I couldn't find any other existing tests for this class as inspiration. But I could try to invest some more time.
  6. core-ci voted on patch set 2 V +1 04/23/24, 13:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56579

  7. Daniel Siepmann uploaded patch set 3 V +1 04/23/24, 14:06

  8. Daniel Siepmann commented on patch set 3 04/23/24, 14:06

    Reply

    I've added tests. The first test is failing without the modification and passes with the patch.
  9. core-ci voted on patch set 3 V +1 04/23/24, 14:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56582

  10. Stefan Bürk commented on patch set 3 04/23/24, 15:11

    MetaDataRepositoryTest.php:28

    Please provide that directly as property and not as assigne ment in the setUp method.
  11. Christian Kuhn commented on patch set 3 04/23/24, 16:30

    MetaDataRepositoryTest.php:28 Reply

    in general, i agree to Daniel: We should rather set properties within __construct() when extending from abstracts since this avoids problems when we for instance add type hints. however, in core we currently systematically use the properties directly. as such, i'd go with the direct property for now, and maybe change the entire core later, including an adaption of 'best practice guidelines'.
  12. Daniel Siepmann uploaded patch set 4 V +1 04/23/24, 16:52

  13. core-ci voted on patch set 4 V +1 04/23/24, 16:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56596

  14. Daniel Siepmann updated the commit message in patch set 5 V +1 04/23/24, 17:54

  15. Daniel Siepmann commented on patch set 5 04/23/24, 17:54

    MetaDataRepositoryTest.php:28 Reply

    Adjusted to follow the requested pattern.
  16. core-ci voted on patch set 5 V +1 04/23/24, 17:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56600

  17. Christian Kuhn uploaded patch set 6 V +1 04/23/24, 18:02

  18. Christian Kuhn voted on patch set 6 CR +1 V +1 04/23/24, 18:03

  19. Stefan Bürk voted on patch set 6 CR +1 V +1 04/23/24, 18:07

  20. core-ci voted on patch set 6 V +1 04/23/24, 18:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/56601

  21. Christian Kuhn voted on patch set 6 CR +2 V +2 04/23/24, 18:59

  22. Christian Kuhn merged patch set 7 04/23/24, 18:59