Issue Bug Closed

#99926PHP Warning when file does not exists.

JAKOTA Design Group GmbH 02/10/23, 14:52 updated 03/14/23, 11:47

Description

Hi

PHP Warning: file_get_contents(/var/www/public/fileadmin/media/user_upload/video.youtube): Failed to open stream: No such file or directory in /var/www/public/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php line 1359

Steps to reproduce:

1. add a youtube video as content element
2. delete the .youtube file from upload folder
3. open page in frontend

LocalDriver.php should check if a file is readable before reading it.

LocalDriver.php line 1359

From:

        return file_get_contents($filePath);

To;

        return is_readable($filePath) ? file_get_contents($filePath) : '';

Or maybe this check is better suited elsewhere?!

Thanks

Reviews 2

History 610

  1. JAKOTA Design Group GmbH changed description 02/10/23, 14:54

  2. JAKOTA Design Group GmbH commented 02/27/23, 22:01

    Sure. If that is the case, I’m all for it.

  3. Gerrit Code Review pushed patch set 1 for main to change 77978 status New Under Review 02/28/23, 09:08

  4. Gerrit Code Review pushed patch set 2 for main to change 77978 02/28/23, 13:50

  5. Thomas Hohn changed assigned to Thomas Hohn 02/28/23, 19:38

  6. Gerrit Code Review pushed patch set 3 for main to change 77978 02/28/23, 20:09

  7. Simon Schaufelberger changed Related to #100048 03/01/23, 00:03

  8. Gerrit Code Review pushed patch set 1 for 11.5 to change 77989 03/01/23, 11:26

  9. Thomas Hohn commented and changed status Under Review Resolved done 0 % 100 % 03/01/23, 11:55

    Applied in changeset commit:ecfd80be34be8f49a5fc770974e4b807b5bac9bf.

  10. Benni Mack changed status Resolved Closed 03/14/23, 11:47