|  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
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: web_programer at mail dot ru
New email:
PHP Version: OS:


 [2017-01-30 15:32 UTC] web_programer at mail dot ru
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__);
mkdir($root, 0777);
file_put_contents(__FILE__, $filetext);
$iterator = new GlobIterator($root.'/*.sql');

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


Add a Patch

Pull Requests

Add a Pull Request


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]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2021-05-20 15:43 UTC]
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: Fri Apr 19 01:01:28 2024 UTC