php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19732 file_exists() does not use include path (needs full path)
Submitted: 2002-10-03 04:08 UTC Modified: 2002-10-03 04:13 UTC
From: sputnick at gmx dot net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.2.3 OS: Linux
Private report: No CVE-ID: None
 [2002-10-03 04:08 UTC] sputnick at gmx dot net
After upgrading from PHP 4.1.1 (Apache 1.3.x) to PHP 4.2.3 (Apache 2.0.42), file_exists() obviously changed its behaviour: it does no longer find files in the current directory. I need to supply the full path. I use the same php.ini, and I did not find any hints in the ChangeLog, so I presume this is a bug. The current directory '.' is in the include path, and require() as well as include() work. I am not using safe mode.

Example:

if(file_exists("functions.inc.php")) {
        include_once("functions.inc.php");
}
else die ("File not found");

does not work, whereas

if(file_exists(getcwd()."/functions.inc.php")) {
        include_once("functions.inc.php");
}
else die ("File not found");

works. Note that it is not necessary to specify the full path in include_once()! Also require("functions.inc.php") would work as expected.

If you should have a work around or a fix, please let me know.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-03 04:13 UTC] edink@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Please search the bug database befeore openning new bug reports. This issue has been solved in both stable and unstable branches.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 15:01:31 2024 UTC