php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60636 Dots in folders results in a open_basedir restriction warning
Submitted: 2012-01-02 13:56 UTC Modified: 2021-05-30 04:22 UTC
Votes:9
Avg. Score:4.0 ± 1.3
Reproduced:7 of 8 (87.5%)
Same Version:2 (28.6%)
Same OS:3 (42.9%)
From: fernando at consultorpc dot com Assigned: cmb (profile)
Status: No Feedback Package: Safe Mode/open_basedir
PHP Version: 5.3.8 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fernando at consultorpc dot com
New email:
PHP Version: OS:

 

 [2012-01-02 13:56 UTC] fernando at consultorpc dot com
Description:
------------
If you try to access a file within a folder that has a dot, an open_basedir 
restriction warning will show up even if the folder is in the allowed paths list.

Test script:
---------------
<?php
// Set open_basedir allowed paths to /home/example:/usr/lib/php:/tmp

file_exists('/home/example/public_html/myfolder.example/file.php'); // This results in a open_basedir restriction warning

Expected result:
----------------
No warning should show up and i should be able to access the file normally.

Actual result:
--------------
The test script results in:

PHP Warning:  file_exists() [<a href='function.file-exists'>function.file-
exists</a>]: open_basedir restriction in effect. 
File(/home/example/public_html/myfolder.example/file.php) is not within the 
allowed path(s): (/home/example:/usr/lib/php:/tmp) in 
/home/example/public_html/test.php on line 3

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-03 17:06 UTC] laruence@php.net
does that /home/example exists? I think this might has nothing to do with the 
*dot*, but a mis-understand warning.
 [2012-01-03 17:06 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2012-01-03 17:13 UTC] fernando at consultorpc dot com
-Status: Feedback +Status: Open
 [2012-01-03 17:13 UTC] fernando at consultorpc dot com
Yes, /home/example exists. If i rename myfolder.example to myfolderexample ( no 
dots ), them it works as expected. Meaning that it will return false without any 
warnings.
 [2012-01-04 04:34 UTC] laruence@php.net
hmm, I can't no reproduce this if you are sure that "/home/example" exists.
 [2012-12-30 09:28 UTC] support at hostinghood dot com
open_basedir works correctly, tested myself.
 [2013-05-29 12:03 UTC] 19982090 at atn dot ac dot at
i habe experienced the same error.
my basedir is like /home/.sites/123/site346/web and the warning comes up if i try 
to call is_file(..../web/data/foldername)
 [2021-05-20 12:09 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-05-20 12:09 UTC] cmb@php.net
Can anyone still reproduce this with any of the actively supported
PHP versions[1]?  Note that the open_basedir *must* exist before
running the script.

[1] <https://www.php.net/supported-versions.php>
 [2021-05-30 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC