php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37556 file_exists does not properly resolve symlinks before applying open_basedir
Submitted: 2006-05-23 02:48 UTC Modified: 2006-06-14 17:48 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: phpdotnet at ericmarques dot com Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 5.1.4 OS: FreeBSD 5.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: phpdotnet at ericmarques dot com
New email:
PHP Version: OS:

 

 [2006-05-23 02:48 UTC] phpdotnet at ericmarques dot com
Description:
------------
file_exists does not properly resolve symlinks before applying open_basedir on "include" scripts.

in my situation
/home is a symlink to /data/home

open_basedir is set to /home/ericmarq/
apache documentroot is set to /home/ericmarq/public_html

Server running cPanel, apache 1.3

This did not happen in php 4.4.2, only happened after upgrade to 5.1.2

Reproduce code:
---------------
-- test1.php --
<?php
include("test2.php");
?>

-- test2.php --
<?php
if (!file_exists("/home/ericmarq/public_html/SUBDIR/does.not.exist.html")){
print "no";
}
?>

Expected result:
----------------
no

Actual result:
--------------
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/ericmarq/public_html/SUBDIR/does.not.exist.html) is not within the allowed path(s): (/home/ericmarq/) in /data/home/ericmarq/public_html/test2.php on line 2
no

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-23 03:01 UTC] phpdotnet at ericmarques dot com
Same problem with other functions too like file_get_contents.

Only happens where the file being performed on is in a sub folder of the script being run.
 [2006-06-14 17:48 UTC] sniper@php.net
See bug #30188
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 02:01:35 2025 UTC