|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22257 stat fails in fread() of fopen()'d file
Submitted: 2003-02-17 14:02 UTC Modified: 2003-02-17 16:42 UTC
From: dev at sonicunion dot co dot uk Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.2.3 OS: Windows 98 SE
Private report: No CVE-ID: None
 [2003-02-17 14:02 UTC] dev at sonicunion dot co dot uk
Using the code:

   $file = fopen("test_index.php", "rb"); 
   $openedfile = fread ($file, filesize ($file)); 

   $string = addslashes ($openedfile); 

   eval ("\$string=\"$string\";"); 

   $string = stripslashes ($string);

On my machine, it triggors the error:
Warning: stat failed for Resource id #1 (errno=2 - No such file or directory) in c:\php\www\sonicunion_beta\\run.php on line 5

When error is surpressed, with @, the file read is not evaled. No other errors occur.

Specs: Win98; Apache 1.3.2; PHP4.2.3;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-17 14:06 UTC] dev at sonicunion dot co dot uk
That double slash in the error ( c:\php\www\sonicunion_beta\\run.php ) should not be there. I re-ran the script and the error still occurs, but with a single slash (..._beta\run.php). This was only caused because I was daft enough to type the URI in wrong in my browser.

[NOTE: The same error DOES still occur!]
 [2003-02-17 16:42 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

We\'re alread at PHP 4.3.1..

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 14:01:24 2020 UTC