php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21531 file_exists() displays warning along with returning FALSE
Submitted: 2003-01-08 16:06 UTC Modified: 2003-01-09 16:00 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: books at medianet dot pl Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.3.0 OS: SunOS 5.8
Private report: No CVE-ID: None
 [2003-01-08 16:06 UTC] books at medianet dot pl
In case that file $file does not exist, invoking:

file_exists($file);

displays warning message, which should not take place.

I've noticed bug report for similar problem for 4.2.1, which was then "fixed in CVS". Deja vu? ;)

Regards,
<kocio />

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-08 16:15 UTC] books at medianet dot pl
In case that file $file does not exist, invoking:

file_exists($file);

displays warning message, which should not take place.

I've noticed bug report for similar problem for 4.2.1, which was then
"fixed in CVS". Deja vu? ;)

Regards,
<kocio />
 [2003-01-08 16:45 UTC] pollita@php.net
What is the exact text of the warning message?
 [2003-01-08 17:14 UTC] kalowsky@php.net
On three different platforms I'm unable to reproduce this bug.  Please provide a bit more detail to this bug.
 [2003-01-08 17:47 UTC] books at medianet dot pl
Warning: file_exists() [function.file-exists.html]: Unable to access file_name.ext in /home/path/to/scripts/funcs.php on line 1234

PHP Version 4.3.0
System SunOS abcde 5.8 Generic_108529-17 i86pc
Configure Command
'./configure' '--with-apache=../apache_1.3.27' '--enable-track-vars' '--enable-safe-mode' '--enable- sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-trans-sid' '--enable-sockets' '--with- openssl=/opt/openssl' '--with-pgsql=/opt/postgres' '--with-mysql=/opt/mysql' '--with-zlib' '--with-gd'

Server API Apache
Virtual Directory Support disabled
PHP API 20020918
PHP Extension 20020429
Zend Extension 20021010
Debug Build no
Thread Safety disabled

The information above I have cut-and-paste from phpinfo().
If you need more, tell me what you exactly need.

Regards,
<kocio />
 [2003-01-08 17:56 UTC] kalowsky@php.net
I'm still unable to reproduce this.  Can this be a case of directory permissions maybe?  
 [2003-01-08 18:10 UTC] sniper@php.net
Please try the latest stable snapshot from here: http://snaps.php.net/

 [2003-01-08 18:14 UTC] books at medianet dot pl
Each and every directory has at least "r-x" permissions. 
The file being tested does not exist, and haven't been there for months (if ever).
 [2003-01-08 18:44 UTC] pollita@php.net
Are you running in safe_mode?

If so, what are the settings of the safe_mode related ini values?
 [2003-01-09 03:34 UTC] books at medianet dot pl
safe_mode On On 
safe_mode_exec_dir /opt/local/bin /opt/local/bin 
safe_mode_gid Off Off 
safe_mode_include_dir no value no value 
safe_mode_allowed_env_vars PHP_ PHP_ 
safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH 

The problematic check is for (non-existing) file within directory tree accessible to http server.

Regards,
<kocio />
 [2003-01-09 16:00 UTC] pollita@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.

file_exists() will no longer throw errors when in safe_mode
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC