Bug #100846
closed
Adminpanel Exception: PHP Warning: filesize(): stat failed
Added by Yannis Viol over 1 year ago.
Updated about 1 month ago.
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).
- 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?
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.
I guess the following would solve it?
$fileSize = is_file($file) ? (int)filesize($file) : 0;
can't currently reproduce it
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.
- Status changed from Needs Feedback to Accepted
- Status changed from Accepted to Under Review
thanks for your feedback, got it running and fixed it
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF