Review main Merged

79718[BUGFIX] Avoid SQL errors in PageRepository->versionOL

Benni Mack CR +2 V +2 Easy +32 −2 updated 07/05/23, 14:00

Commit message

This change adds an additional guard clause check
to avoid SQL errors when an invalid row is entered.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Oliver Klee +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1216

  1. Benni Mack uploaded patch set 1 07/05/23, 11:16

  2. core-ci voted on patch set 1 V -1 07/05/23, 11:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43492

  3. Oliver Klee commented on patch set 1 07/05/23, 11:31

    Should I make the changes I've proposed, or would you prefer to do them?

    PageRepositoryTest.php:657

    I propose we state what the method does here (instead of what it does not do): ``` versionOLForAnInvalidRowReturnsEmptyArray ```

    PageRepositoryTest.php:664

    For comparing with arrays, we can use the type-safe `assertSame` (in both places) so the test is as strict as possible: ```php self::assertEquals([], $input); ```

    PageRepositoryTest.php:665

    I recommend moving this to a second test (or, in this case, a two-item data provider for this test). The benefit of this is that if some part of the test fails, it's easier to see which part of the behavior is broken and which isn't. (With a test that checks multiple behaviors, this is harder as the test exits at the first failed assertion.)
  4. Benni Mack commented on patch set 1 07/05/23, 11:47

    Reply

    go ahead
  5. Oliver Klee uploaded patch set 2 V -1 07/05/23, 12:03

  6. Oliver Klee commented on patch set 1 07/05/23, 12:05

    I have done the changes to the tests. The tests still are failing, though, because the UID always gets set. I don't know if this is the expected behavior (and we should adapt the tests accordingly), or if the tests are correct, and we need to adapt the `versionOL` method. Do you know more?

    Reply

    Done

    PageRepositoryTest.php:657 Reply

    Done

    PageRepositoryTest.php:664 Reply

    Done

    PageRepositoryTest.php:665 Reply

    Done
  7. core-ci voted on patch set 2 V -1 07/05/23, 12:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43500

  8. Benni Mack uploaded patch set 3 V -1 07/05/23, 12:55

  9. core-ci voted on patch set 3 V +1 07/05/23, 13:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43513

  10. Oliver Klee commented on patch set 4 V +1 07/05/23, 13:39

    Published edit on patch set 3.
  11. Oliver Klee commented on patch set 4 V +1 07/05/23, 13:40

    I've re added the empty lines in the test that separate the setup, execute and verify steps in order to reduce the cognitive load required for understanding the structure of the test.
  12. Oli Bartsch voted on patch set 4 V +1 CR +1 07/05/23, 13:40

  13. core-ci voted on patch set 4 V +1 07/05/23, 13:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43522

  14. Oliver Klee voted on patch set 4 CR +1 07/05/23, 13:52

  15. Benni Mack voted on patch set 4 V +2 CR +2 07/05/23, 14:00

  16. Benni Mack merged patch set 5 07/05/23, 14:00