php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11793 file_exists() and friends
Submitted: 2001-06-29 03:09 UTC Modified: 2001-06-30 00:02 UTC
From: bf at ez dot no Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.6 OS: Redhat Linux
Private report: No CVE-ID: None
 [2001-06-29 03:09 UTC] bf at ez dot no
I'm having problem with file_exists(), is_file(), 
file_size() since the upgrade to 4.0.6. It does not work 
if I supply a variable as a filename. E.g.

file_exists( $var ); will return false even if the 
variable contains a correct path.

file_exists( "path/to/file.txt" ); works. 

Same for the is_file() and file_size();

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-29 04:51 UTC] bf at ez dot no
This was not a PHP problem.
 [2002-02-23 01:22 UTC] frink at thepurplebuffalo dot net dot XXXXXX
I was having trouble with the following code:

      $date = `date "+%d-%b-%Y"`;
      $data_file = "data/" . $date;

      rtrim($data_file);
#      $data_file = rtrim($data_file);

      clearstatcache();
      if( file_exists($data_file) ) {
        $curr_data = "yes";
        } else {
        $curr_data = "no";
      }

For the record the solution was to change the "rtrim" line to the one I have commented out.  I was thinking in perl. :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC