php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40867 open_basedir does not allow access to "/tmp" if "/tmp/" is in open_basedir list
Submitted: 2007-03-20 17:18 UTC Modified: 2007-03-25 13:57 UTC
From: phpbugs at thequod dot de Assigned:
Status: Not a bug Package: Safe Mode/open_basedir
PHP Version: 5CVS-2007-03-20 (CVS) OS: Ubuntu Linux
Private report: No CVE-ID: None
 [2007-03-20 17:18 UTC] phpbugs at thequod dot de
Description:
------------
If open_basedir is set to "/tmp/" and you do
<?php
is_dir( '/tmp' );
?>
you get a warning:
Warning: is_dir(): open_basedir restriction in effect. File(/tmp) is 
not within the allowed path(s): (/tmp/) in ..

Bug 39123 "Default for "upload_tmp_dir" changed to "/tmp" 
(regression)" (http://bugs.php.net/39123) is related. Maybe the 
regression's root is here?

Has this behaviour changed in PHP5 (e.g. 5.1.x)?

btw: the reason for not having "/tmp" in the open_basedir setting is 
that it would allow access to all directories beginning with "tmp" 
in the root filesystem.

Reproduce code:
---------------
$ php -d open_basedir=/tmp/ -d error_reporting=E_ALL \
 -d display_errors=1 -r 'echo is_dir( "/tmp" ) ? 1 : 0;'


Expected result:
----------------
1

Actual result:
--------------
Warning: is_dir(): open_basedir restriction in effect. File(/tmp) is 
not within the allowed path(s): (/tmp/) in Command line code on line 
1
0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-20 17:31 UTC] tony2001@php.net
Yeah, directory /tmp is in /, not in /tmp/.
 [2007-03-25 13:57 UTC] phpbugs at thequod dot de
..and directory "/tmp/" is in "/tmp"?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 10:01:28 2024 UTC