Review main Merged

87660[TASK] Add ScalarStringMatcher Extension Scanner for TYPO3_MODE reports

Garvin Hicking CR +2 V +2 Hard +272 −0 updated 01/09/25, 14:27

Commit message

An upgrade to TYPO3 v12 can be painful when backend or frontend
modules (or even the Database Analyzer) bails out with a white
page. Usually this would lead to inspection of logfiles,
checking if PHP's `error_reporting` or `display_errors` is
not properly set, looking for PHP/Webserver coredumps,
problems in HTTP headers, CSP errors and much more, just
to find out that a

  `defined('TYPO3_MODE') or die()`

was left in some PHP file of an extension, which needs
to be replaced with `TYPO3` (see #92947 and #96107).

The Extension Scanner only scanned for the full
PHP constant usage before.

With this patch, these "magic strings" can now also
be scanned and reported, making debugging of a
malfunctioning upgrade much easier for developers
and especially integrators.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Thomas Hohn +1
    • Simon Praetorius +1
    • Stefan Bürk +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Oli Bartsch +1
    • Thomas Hohn +1
    • Stefan Bürk +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 3

Files 5

Review log 1721

  1. Garvin Hicking uploaded patch set 1 01/07/25, 21:40

  2. Garvin Hicking updated the commit message in patch set 2 01/07/25, 21:40

  3. core-ci voted on patch set 1 V -1 01/07/25, 21:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72060

  4. core-ci voted on patch set 2 V -1 01/07/25, 21:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72061

  5. Garvin Hicking uploaded patch set 3 V -1 01/07/25, 22:29

  6. core-ci voted on patch set 3 V +1 01/07/25, 22:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72062

  7. Lina Wolf commented on patch set 3 01/08/25, 07:01

    This is very much needed! I am wondering however: When there is such a die(), can we ever make it all the way to the Extension scanner? did you test that?
  8. Garvin Hicking commented on patch set 3 01/08/25, 07:07

    Reply

    Yes! I tested it and it works conceptually because the extension scanner does not load the files but just statically analyzes them (like PHPstan via php-parser). Happy you find it useful, too!
  9. Oli Bartsch commented on patch set 3 V +1 01/08/25, 07:16

    ScalarStringMatcher.php:65

    What's the reason for a "weak" match? Because it's a string? - Besides that, great patch and works!
  10. Garvin Hicking commented on patch set 3 01/08/25, 07:56

    ScalarStringMatcher.php:65 Reply

    My reasoning was that maybe the string could be used for other internal distinctions or so, just as plain variable content, yes. It is rather strong in reality, but we could raise that in the future if it proves helpful in real-life scenarios?
  11. Garvin Hicking uploaded patch set 4 V +1 01/08/25, 08:04

    Add test scenario for trimming and add note about weak match
  12. core-ci voted on patch set 4 V +1 01/08/25, 08:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72081

  13. Simon Praetorius commented on patch set 4 CR +1 01/08/25, 09:55

    This is a great addition, future TYPO3-updating Simon thanks you!
  14. Garvin Hicking commented on patch set 4 01/08/25, 10:06

    ScalarStringMatcher.php:65 Reply

    Added a note for this to maybe adjust, ok for you?
  15. Oli Bartsch commented on patch set 4 CR +1 V +1 01/08/25, 10:29

    ScalarStringMatcher.php:65 Reply

    Acknowledged
  16. Oli Bartsch commented on patch set 4 01/08/25, 10:29

    ScalarStringMatcher.php:65 Reply

    Done
  17. Christian Kuhn voted on patch set 4 CR +1 V +1 01/08/25, 11:19

  18. Thomas Hohn voted on patch set 4 CR +1 V +1 01/08/25, 11:22

  19. Stefan Bürk voted on patch set 4 CR +1 V +1 01/09/25, 14:18

  20. Garvin Hicking voted on patch set 4 CR +2 V +2 01/09/25, 14:27

  21. Garvin Hicking merged patch set 5 01/09/25, 14:27