php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35744 safe_mode error?
Submitted: 2005-12-20 13:47 UTC Modified: 2005-12-20 15:38 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rudenko at id dot com dot ua Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.1.1 OS: Fedora Core 3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rudenko at id dot com dot ua
New email:
PHP Version: OS:

 

 [2005-12-20 13:47 UTC] rudenko at id dot com dot ua
Description:
------------
Diffrent results for is_file, file_exists and is_readable 

(php.ini safe_mode = On, script executed by root user)


Reproduce code:
---------------
<?php
$file = "/etc/passwd";

echo "File $file:\n";

if (is_file($file)) {
	echo "is_file: true\n";
} else {
	echo "is_file: false\n";
}

if (file_exists($file)) {
	echo "file_exists: true\n";
} else {
	echo "file_exists: false\n";
}

if (is_readable($file)) {
	echo "is_readable: true\n";
} else {
	echo "is_readable: false\n";
}
?>

Expected result:
----------------
is_file: true
file_exists: true
is_readable: true

or 

is_file: false
file_exists: false
is_readable: false



Actual result:
--------------
is_file: false
file_exists: true
is_readable: true


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-20 13:58 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip

Can't reproduce.
 [2005-12-20 14:57 UTC] rudenko at id dot com dot ua
Installing latest snapshot 2005-12-20 11:30 does not solve this problem
 [2005-12-20 15:03 UTC] tony2001@php.net
I'm still unable to reproduce it.
 [2005-12-20 15:14 UTC] rudenko at id dot com dot ua
I reproduce same bug on FreeBSD 6 server.

1. In your php.ini file you must set safe_mode = On
2. You must start script from shell
 [2005-12-20 15:26 UTC] tony2001@php.net
#php -d safe_mode=1 -r 'var_dump(ini_get("safe_mode")); var_dump(is_file("/etc/passwd")); var_dump(file_exists("/etc/passwd")); var_dump(is_readable("/etc/passwd"));'
string(1) "1"
bool(true)
bool(true)
bool(true)

# whoami
root

PHP 5.0.6-dev
PHP 5.1.2-dev
PHP 4.4.2RC2-dev
 [2005-12-20 15:34 UTC] rudenko at id dot com dot ua
If I use your script I have same results as yours.
bool(true)
bool(true)
bool(true)
 [2005-12-20 15:38 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC