|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-31 19:23 UTC] carsten_sttgt at gmx dot de
[2007-10-31 21:16 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 03:00:01 2025 UTC |
Description: ------------ The filesize() function always fails, even if the file opens up properly and without warnings (it has been verified that there is no file access issue and also that PHP knows that the file is there). The warning is Warning filesize: stat failed for resource #xxx etc. Please note that it has been confirmed at absolutely all permissions have been granted to both the directory and the file and that the file is existing and can also be opened by PHP. Either this is a serious error or a function as ordinary as filesize() is made too complex to use, which in itself is a problem! This has been tested on several servers. If the file does not exist, a proper warning is thrown, meaning that non-existence of the file is not any issue. Reproduce code: --------------- <?php $file=fopen("uploads/test.txt","rb"); $contents=fread($file, filesize($file)); fclose($file); ?> Expected result: ---------------- (no output, no warnings, no errors!) Actual result: -------------- Warning: filesize() [function.filesize]: stat failed for Resource id #3 in /www/110mb.com/w/a/v/i/c/l/e/_/wavicle/htdocs/test.php on line 4 Warning: fread() [function.fread]: Length parameter must be greater than 0 in /www/110mb.com/w/a/v/i/c/l/e/_/wavicle/htdocs/test.php on line 4