php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37987 invalid return of file_exists() in safe mode
Submitted: 2006-07-02 13:31 UTC Modified: 2006-07-02 13:51 UTC
From: tokul at users dot sourceforge dot net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5.1.4 OS:
Private report: No CVE-ID: None
 [2006-07-02 13:31 UTC] tokul at users dot sourceforge dot net
Description:
------------
PHP documentation (http://www.php.net/file-exists) states that file_exists() function returns false, when file is inaccessible due to safe mode restrictions.

Tested PHP 4.3.10, 4.4CVS (200607021030), 5.1.4 and 5.2CVS(200607021030).

In PHP 5.1.4 and 5.2CVS file_exists() function returns true, when file exists, but is inaccessible due to safe mode restrictions. Other php versions work as documented.

Reproduce code:
---------------
<?php
var_dump(ini_get('safe_mode'));
var_dump(file_exists('/usr/games/fortune'));
var_dump(is_file('/usr/games/fortune'));
var_dump(is_dir('/usr/games/fortune'));
?>


Expected result:
----------------
When safe_mode is on
----
string(1) "1"
bool(false)
bool(false)
bool(false)
----

When safe_mode is off
----
string(0) ""
bool(true)
bool(true)
bool(false)
----

Actual result:
--------------
When safe_mode is on
----
string(1) "1"
bool(true)
bool(false)
bool(false)
----

When safe_mode is off
----
string(0) ""
bool(true)
bool(true)
bool(false)
----

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-02 13:51 UTC] iliaa@php.net
This bug has been fixed in CVS.

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/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC