Project

General

Profile

Actions

Bug #100846

closed

Adminpanel Exception: PHP Warning: filesize(): stat failed

Added by Yannis Viol 12 months ago. Updated 11 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
AdminPanel
Start date:
2023-05-09
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

The filesize function call on line 135 in the GeneralInformation.php file throws this Warning.
This is because the given parameter does only contain the fileadmin path (e.g. /fileadmin/processed/5/9/csm_123.png).

Actions #1

Updated by Georg Ringer 12 months ago

  • Status changed from New to Needs Feedback
  • Target version changed from 12 LTS to Candidate for patchlevel

thanks for creating the issue! the line looks currently like this

$fileSize = (int)@filesize($file);

because of the @ there shouldn't be a warning - are you using an outdated version?

Actions #2

Updated by Steffen Hastädt 12 months ago

We are using the current v11 version 11.5.26 and now 11.5.27. I think with PHP >=8.0 it depends on the error setting, and with our special error handler, the warning was still triggered.

But we tested this with v11 and v12, and in both versions, $file has always only the public path (/fileadmin/processed/5/9/csm_123.png), and therefore $fileSize is always 0.

Actions #3

Updated by Georg Ringer 12 months ago

I guess the following would solve it?

$fileSize = is_file($file) ? (int)filesize($file) : 0;

can't currently reproduce it

Actions #4

Updated by Steffen Hastädt 12 months ago

When you say, "can't currently reproduce it" do you get the correct path in $file?

The file itself exists but in /var/www/web/fileadmin/processed/5/9/csm_123.png. The error occurs because the admin panel checks for /fileadmin/processed/5/9/csm_123.png, which is the wrong path. So the filesize still would be 0, even if the file is present.

We tested this in v11 and v12 with different installations. The frontend can render the images, but when you open the admin panel, that error occurs, and the path always starts with "/fileadmin...".

I think I will debug this further and come back to this.

Actions #5

Updated by Georg Ringer 12 months ago

  • Status changed from Needs Feedback to Accepted
Actions #6

Updated by Gerrit Code Review 12 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79019

Actions #7

Updated by Georg Ringer 12 months ago

thanks for your feedback, got it running and fixed it

Actions #8

Updated by Gerrit Code Review 11 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79241

Actions #9

Updated by Georg Ringer 11 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF