Issue Bug Closed

#104039Uncaught TYPO3 Exception: fwrite(): Argument #2 ($data) must be of type string, false given | TypeError thrown in file GeneralUtility.php in line 1604.

Bastian Holzem 06/11/24, 08:17 updated 08/07/24, 09:08

Description

Core: Exception handler (WEB): Uncaught TYPO3 Exception: fwrite(): Argument #2 ($data) must be of type string, false given | TypeError thrown in file /../vendor/typo3/cms-core/Classes/Utility/GeneralUtility.php in line 1604.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 1

History 5

  1. Oliver Hader commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-06-11T08:48:38+00:00" > 06/11/24, 08:48 </span>

    Can you please provide the location/class that is calling \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile? Thanks!

  2. Bastian Holzem commented <span data-processor="relativetime" data-value="2024-06-11T09:00:13+00:00" > 06/11/24, 09:00 </span>

    Oliver Hader wrote in #note-2:
    > Can you please provide the location/class that is calling \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile? Thanks!

    error occurred directly after updating TYPO3 12.4.15 to TYPO3 12.4.16
    but probably only once, now it doesn’t occur anymore, I’ll have to check again with the next update

  3. Georg Ringer commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2024-06-25T04:42:11+00:00" > 06/25/24, 04:42 </span>

    Hey Bastian,

    as this happened only once I am closing this issue. Feel free to open a new issue if this can be reproduced on a setup and is not related to e.g. switching versions and not clearing various caches.

  4. Felix Heller commented and changed attached callstack_generalutility_writefile.png <span data-processor="relativetime" data-value="2024-08-07T09:08:37+00:00" > 08/07/24, 09:08 </span>

    I stumbled across the same problem. It always occurs once after a TYPO3 surf deployment was run for the affected project.

    The reason was a missing JavaScript file that I tried to include in TypoScript:

    page.includeJS.nonExistingFile = EXT:foo/Resources/Public/JavaScript/Build/config.js

    TYPO3 tries to compress this file and calls GeneralUtility::getUrl for this path. As there is no such file, the getUrl method returns false, but then the ResourceCompressor tries to write false (bool) into a file in typo3temp/assets/compressed/external-abcdefgh12345678.

    This is the call stack of PHP Xdebugger:
    callstack_generalutility_writefile.png

    The solution for this problem in my case was quite simple: Don’t include non-existing JavaScript files in TypoScript. 😉