Review 11.5 Merged

74834[BUGFIX] Apply empty values in language-overlay

Benni Mack CR +2 V +2 Easy +28 −1 updated 06/09/22, 14:37

Commit message

Some default fields (e.g. tt_content.bodytext) can contain null values.
TYPO3 first fetches the data in the default language and then overlays
the rows data with the translation values. The overlay method inspects
each array item with the php isset() function. This validates not only
the existence of the array key, but also the values. null and
false values evaluated as false. Empty strings evaluate as true.
This leads to inconsistent output in the frontend.

The overlay now valides only the array key existence and applies also
empty values.

Review

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

Issues 1

Files 3

Review log 1216

  1. Benni Mack commented on patch set 1 06/08/22, 11:38

    Cherry Picked from branch main. The following files contain Git conflicts: * typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php * typo3/sysext/core/Tests/Functional/Fixtures/pages.csv
  2. Benni Mack commented on patch set 2 06/08/22, 11:39

    Published edit on patch set 1.
  3. Benni Mack marked it ready for review 06/08/22, 11:39

  4. core-ci voted on patch set 1 V -1 06/08/22, 11:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27807

  5. core-ci voted on patch set 2 V -1 06/08/22, 11:53 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27808

  6. André Buchmann uploaded patch set 3 06/08/22, 13:51

  7. core-ci voted on patch set 3 V -1 06/08/22, 13:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27823

  8. André Buchmann uploaded patch set 4 06/08/22, 14:05

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

  10. André Buchmann commented on patch set 4 06/08/22, 14:23

    PageRepositoryTest.php:629

    With php7.4 the return type is string instead of integer here. I used the type casting here, but we can also use self::assertEquals() if you prefer?
  11. Oliver Klee commented on patch set 4 06/08/22, 15:03

    PageRepositoryTest.php:629 Reply

    Are you really sure the return type is PHP-version-specific? I'd recommend keeping the comparison as strict as possible (without any casts). If $overlaidRecord['_LOCALIZED_UID'] is a string, this would look like this: self::assertSame('2', $overlaidRecord['_LOCALIZED_UID']);
  12. André Buchmann commented on patch set 4 06/09/22, 05:44

    PageRepositoryTest.php:629 Reply

    Yep, I'm sure that php 8.1 returns int and 7.4 + 8.0 are returning a string. I've tested both variants with this test call (changed only the php-version) in my local 11.5 clone: Build/Scripts/runTests.sh -s functional -p 8.1 typo3/sysext/core/Tests/Functional/Domain/Repository/PageRepositoryTest.php self::assertSame('2', $overlaidRecord['_LOCALIZED_UID']); Fails on php 8.1, but succeeds on php 7.4 + 8.0 self::assertSame(2, $overlaidRecord['_LOCALIZED_UID']); Succeeds on php 8.1, but fails on php 7.4 + 8.0 --- In the pipeline for Patchset 3 the functional tests with php 8.0 succeed...
  13. André Buchmann commented on patch set 4 06/09/22, 05:54

    PageRepositoryTest.php:629 Reply

    Using mariadb or postgres with any of the 3 php versions will return an int. But with sqlite the return type differs as described in the previous comment.
  14. Oliver Klee commented on patch set 4 V +1 CR +1 06/09/22, 07:43

    PageRepositoryTest.php:629 Reply

    Ah, thanks for the explanation! Then we should indeed keep the int cast.
  15. Benni Mack voted on patch set 4 V +2 CR +2 06/09/22, 14:37

  16. Benni Mack merged patch set 5 06/09/22, 14:37