ID: 41858
User updated by: caleblangeslag at hotmail dot com
-Summary: filesize() problem
Reported By: caleblangeslag at hotmail dot com
Status: Open
Bug Type: Filesystem function related
Operating System: Windows XP Home SP2
PHP Version: 4.4.7
New Comment:
I'm sorry, this bug report has been determined invalid. Please remove
this bug from the listings. It has been determined that the file
unexepectedly no longer contains content however I am aware this is NOT
caused by PHP in anyway. Sorry for the inconvenience.
Previous Comments:
------------------------------------------------------------------------
[2007-06-29 21:25:22] caleblangeslag at hotmail dot com
Description:
------------
filesize() returns '0' with any file and does not raise an error even
though error_reporting is enabled. Also keep in note that I am using the
software bundle named "XAMPP" and have upgraded the version of PHP 4.
I've also checked the existance of the file. I can include the file
using include() perfectly, however filesize() only returns 0 but not an
error. When I change $filename to an invalid filename, filesize() does
produce an error. I've also tried clearstatcache() and it made no
difference.
Reproduce code:
---------------
class classname
{
function somefunction()
{
$filename = "tpl/default/nav.inc.php";
$handle = fopen($filename, 'r'); // Works (doesn't return FALSE)
$content = fread($handle,filesize($filename)); // fails because
filesize() returns 0.
}
}
Expected result:
----------------
Contents of the file
Actual result:
--------------
Warning: fread() [function.fread]: Length parameter must be greater
than 0. in C:\Program Files\xampp\htdocs\KeenManager\include\core.php on
line 1411
(Where line 1411 is: $content = fread($handle,filesize($filename));
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41858&edit=1