Bug #100846
closedAdminpanel Exception: PHP Warning: filesize(): stat failed
100%
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).
Updated by Georg Ringer over 1 year 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?
Updated by Steffen Hastädt over 1 year 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.
Updated by Georg Ringer over 1 year ago
I guess the following would solve it?
$fileSize = is_file($file) ? (int)filesize($file) : 0;
can't currently reproduce it
Updated by Steffen Hastädt over 1 year 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.
Updated by Georg Ringer over 1 year ago
- Status changed from Needs Feedback to Accepted
Updated by Gerrit Code Review over 1 year 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
Updated by Georg Ringer over 1 year ago
thanks for your feedback, got it running and fixed it
Updated by Gerrit Code Review over 1 year 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
Updated by Georg Ringer over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 2bae8f143de78fb47a722d243d516a323a6c609d.