Review main Merged

75028[BUGFIX] Cast folder name in tree provider to string

Andreas Kienast CR +2 V +2 Easy +1 −0 updated 07/05/22, 18:11

Commit message

The method FileStorageTreeProvider->getSubfoldersRecursively() iterates
an array of subfolders and prepares folder information based on the
iterated data.

This functionality has a minor flaw, thanks to PHP, in case a folder
is named with numbers only, PHP treats array indices as integer if they
can be parsed as such, leading to TypeErrors as the method
prepareFolderInformation() expects a nullable string.

The passed subfolder name is now cast to string to solve this issue.

Review

  • Code review CR +2 Done
    • Andreas Kienast +2
    • Oliver Klee +1
    • Stefan Bürk +1
    • Nikita Hovratov +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Andreas Kienast +2
    • Stefan Bürk +1
    • Nikita Hovratov +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1620

  1. Andreas Kienast uploaded patch set 1 07/04/22, 20:34

  2. Andreas Kienast uploaded patch set 2 07/04/22, 20:35

  3. core-ci voted on patch set 1 V +1 07/04/22, 20:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28638

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

  5. Stefan Bürk commented on patch set 2 07/04/22, 21:01

    FileStorageTreeProvider.php:212

    What do you thing, should we not better a cast line to sanatize it for the whole loop directly after the loop start between L203/204: ``` $subFolderName = (string)$subFolderName; ``` This would eventually "avoid" cast errors in the future which may be string strict if something changes.
  6. Andreas Kienast commented on patch set 2 07/04/22, 21:03

    FileStorageTreeProvider.php:212 Reply

    Ack
  7. Andreas Kienast uploaded patch set 3 07/04/22, 21:05

  8. Oliver Klee voted on patch set 3 CR +1 07/04/22, 21:11

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

  10. Simon Schaufelberger updated the commit message in patch set 4 07/04/22, 23:26

  11. Simon Schaufelberger voted on patch set 4 V +1 CR +1 07/04/22, 23:27

  12. core-ci voted on patch set 4 V +1 07/04/22, 23:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/28643

  13. Simon Schaufelberger commented on patch set 4 07/04/22, 23:42

    This class doesn't have any tests yet. Would you be willing to create a test that covers at least the getSubfoldersRecursively method?
  14. Andreas Kienast commented on patch set 4 07/05/22, 06:40

    Reply Unresolved

    I can give it a try, but that will take some time.
  15. Nikita Hovratov voted on patch set 4 V +1 CR +1 07/05/22, 06:57

  16. Stefan Bürk voted on patch set 4 V +1 CR +1 07/05/22, 08:22

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

  18. Oliver Klee commented on patch set 4 07/05/22, 10:24

    I have created https://review.typo3.org/c/Packages/TYPO3.CMS/+/75033 to fix the root cause (or the incorrect annotations) of this bug.
  19. Andreas Kienast voted on patch set 4 V +2 CR +2 07/05/22, 18:10

  20. Andreas Kienast merged patch set 5 07/05/22, 18:11