Review main Abandoned

81159[BUGFIX] Prevent writing failed external file content result to disk

Nikita Hovratov CR 0 V 0 Easy +3 −0 updated 02/18/24, 15:58

Commit message

When the result of GeneralUtility::getUrl is false, then the call to
GeneralUtility::writeFile should be skipped. Otherwise, `fopen` will
receive a bool as the second parameter and will fail.

This is also a preparation for GeneralUtility::getUrl to get strict
parameter typing.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 1

Review log 56

  1. Nikita Hovratov uploaded patch set 1 09/21/23, 15:47

  2. core-ci voted on patch set 1 V +1 09/21/23, 15:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/47019

  3. Christian Kuhn commented on patch set 1 09/21/23, 15:59

    ResourceCompressor.php:588

    uh, this method smells really bad: the return value does not change if fetching an external file failed: it returns a filename even if that file has not been written at all. it may be much better if the method would throw a (specific, not global) exception if retrieving the file failed, the two callers should then try-catch it and act accordingly. *maybe* the method could also differentiate between "local file existed already, so here is the file path, but i'm unsure if it's up-to-date". unsure. anyway, i think with adding this patch, the method gets even worse than before, and we should fix this somehow now, instead. it also seems to be unwise to calculate $filename within the method ... maybe it would be better to extract this?
  4. Nikita Hovratov commented on patch set 1 09/21/23, 17:27

    ResourceCompressor.php:588 Reply Unresolved

    yes lolli, this method is bad. But: I wanted to restore the old behavior with PHP 7.4 where types were not enforced in fwrite. Maybe we could first get this in and then improve it in main. Anyway, I got this error with an includeCSS on a non-existing file. Of course it would be better to display an error: "Hey, this file does not exist.". But to not be breaking for older versions, this should be handled gracefully.
  5. Oliver Klee commented on patch set 1 10/08/23, 13:25

    How should we proceed here?
  6. Nikita Hovratov abandoned the change 02/18/24, 15:58

    Not working on this anymore.