php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74016 open_basedir restriction effect when remove and create the same dir
Submitted: 2017-01-30 15:32 UTC Modified: 2021-05-20 15:43 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: web_programer at mail dot ru Assigned: cmb (profile)
Status: Duplicate Package: Safe Mode/open_basedir
PHP Version: 5.6.30 OS: all
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: web_programer at mail dot ru
New email:
PHP Version: OS:

 

 [2017-01-30 15:32 UTC] web_programer at mail dot ru
Description:
------------
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'GlobIterator::__construct(): open_basedir restriction in effect

When remove and create dir where script is situated.
When simply use GlobIterator on any dirs, there are no problems.

Test script:
---------------
//in testdir/test.php

$root = $_SERVER['DOCUMENT_ROOT'].'/testdir';
$filetext = file_get_contents(__FILE__);
unlink(__FILE__);
rmdir($root);
mkdir($root, 0777);
file_put_contents(__FILE__, $filetext);
clearstatcache();
$iterator = new GlobIterator($root.'/*.sql');
print_r($iterator);

Expected result:
----------------
GlobIterator Object ( [pathName:SplFileInfo:private] => [glob:DirectoryIterator:private] => ...........

Actual result:
--------------
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'GlobIterator::__construct(): open_basedir restriction in effect

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-01 09:00 UTC] andrew dot nester dot dev at gmail dot com
What is your open_basedir setting?
 [2017-02-01 13:05 UTC] web_programer at mail dot ru
"C:/apache and so on". It does not depends on concrete setting^

Globiterator fine works with dir where script is (because open_basedir setting allows it), but after rmdir and create the same this dir it doesn't: restriction
 [2021-05-20 15:43 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2021-05-20 15:43 UTC] cmb@php.net
This has nothing to do with deleting and recreating the directory,
but is rather a general issue of GlobIterator and open_basedir,
see bug #65069.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 17:01:32 2024 UTC