php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41858 filesize() problem (bogus, please delete)
Submitted: 2007-06-29 21:25 UTC Modified: 2007-06-30 02:15 UTC
From: caleblangeslag at hotmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.4.7 OS: Windows XP Home SP2
Private report: No CVE-ID: None
 [2007-06-29 21:25 UTC] 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));

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-30 00:23 UTC] caleblangeslag at hotmail dot com
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.
 [2007-06-30 02:15 UTC] rasmus@php.net
User-requested bogus
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 21:01:30 2024 UTC