php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38827 mkdir fails with links and open_basedir restriction
Submitted: 2006-09-14 12:35 UTC Modified: 2006-09-25 13:32 UTC
From: kore@php.net Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 5.2.0RC3 OS: Solaris 8
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: kore@php.net
New email:
PHP Version: OS:

 

 [2006-09-14 12:35 UTC] kore@php.net
Description:
------------
mkdir() will fail, if open_basedir restricts the access to a path which is only a link, but not a real path.

Reproduce code:
---------------
Directory structure:
/path/
 `- htdocs/
   `- mkdir.php
   `- var/ -> /path/var
 `- var/

Ini settings:
open_basedir = '/path/htdocs:/path/var';

Code: (mkdir.php)
<?php
// This will work on Linux, BSD, but not on Solaris
mkdir('/path/htdocs/var/testdir');

Expected result:
----------------
Creating the directory.

Actual result:
--------------
Warning: mkdir(): open_basedir restriction in effect. File(/path/htdocs/var/testdir) is not within the allowed path(s): ('/path/htdocs:/path/var') in /path/htdocs/mkdir.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-25 13:32 UTC] tony2001@php.net
Actually it doesn't work on ALL systems because of this:
    open_basedir = ' value '
is not the same as
    open_basedir = "value"

Pay attention to this part of the error message:
File(/path/htdocs/var/testdir) is not within the allowed path(s):------->('/path/htdocs:/path/var')<--------

Apparently /path/htdocs/var/testdir IS NOT within the "'/path/htdocs" directory.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 15:01:28 2024 UTC