Review main Merged

63437[BUGFIX] Prevent TypeError in AssetCollector related ViewHelpers

Oli Bartsch CR +2 V +2 Easy +8 −2 updated 02/26/20, 16:04

Commit message

The two new ViewHelpers `CssViewHelper` and `ScriptViewHelper`
automatically render the content of their body if no source file
is supplied in the ViewHelpers argument. However if the body is
empty, NULL is passed to the AssetCollectors add inline code functions.
This leads to a TypeError as these parameters are type hinted.

Therefore the body content is now checked before
the methods get called to prevent passing NULL or an empty string.

Review

  • Code review CR +2 Done
    • Susi Moog +2
    • Jens Ulrich +1
    • Daniel Goerz +1
    • Georg Ringer +1
    • Oliver Klee +1
  • Verified V +2 Done
    • Susi Moog +2
    • Jens Ulrich +1
    • Daniel Goerz +1
    • Georg Ringer +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 1518

  1. Oli Bartsch uploaded patch set 1 02/26/20, 08:46

  2. TYPO3com voted on patch set 1 V +1 02/26/20, 08:57 Completed build in 10m 24s on Wed, 26 Feb, 08:57 AM Test Summary: 71997 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-710

  3. Oli Bartsch commented on patch set 1 02/26/20, 08:58

    I want to point out that I'm aware that in general TypeErrors are fine to inform the dev that wrong types were used. But as this error results from a ViewHelper used in a Fluid Template - so no direct relation to PHP - which therefore also often gets created by Frontend devs with no knowledge about PHP and especially not used data types, we should catch this one.
  4. Georg Ringer commented on patch set 1 02/26/20, 09:04

    I am not sure if it wouldn't be better to call $this->renderChildren() only once instead of multiple times, performance wise?
  5. Daniel Siepmann commented on patch set 1 02/26/20, 09:08

    CssViewHelper.php:96

    Not sure about performance, maybe that should be rendered once? Right now `renderChildren()` is called three times. Even if ugly, that one could be an if inside the else. Maybe someone with more knowledge can answer that concern.
  6. Oli Bartsch uploaded patch set 2 02/26/20, 09:25

  7. TYPO3com voted on patch set 2 V +1 02/26/20, 09:37 Completed build in 12m 10s on Wed, 26 Feb, 09:37 AM Test Summary: 71997 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-711

  8. Oli Bartsch commented on patch set 2 02/26/20, 12:45

    CssViewHelper.php:96 Reply

    Done
  9. Georg Ringer voted on patch set 2 V +1 CR +1 02/26/20, 13:03

  10. Susi Moog updated the commit message in patch set 3 02/26/20, 13:30

  11. Susi Moog voted on patch set 3 CR +1 02/26/20, 13:31

  12. TYPO3com voted on patch set 3 V +1 02/26/20, 13:42 Completed build in 11m 35s on Wed, 26 Feb, 01:42 PM Test Summary: 71997 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-717

  13. Oliver Klee voted on patch set 3 CR +1 02/26/20, 13:43

  14. Jens Ulrich commented on patch set 3 V +1 CR +1 02/26/20, 13:44

    > Patch Set 3: Code-Review+1
  15. Georg Ringer voted on patch set 3 V +1 CR +1 02/26/20, 14:12

  16. Susi Moog voted on patch set 3 V +2 CR +2 02/26/20, 16:03

  17. Daniel Goerz voted on patch set 3 V +1 CR +1 02/26/20, 16:04

  18. Susi Moog merged patch set 4 02/26/20, 16:04