|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-02-05 18:42 UTC] smartgenius1 at yahoo dot com
Description:
------------
The function chdir() does NOT obey the open_basedir restriction on windows. Chdir() ONLY checks the UID of the directories; and on Windows there are no UIDs. So it is possible to do
chdir("../");
and it works on windows; even if the open_basedir restriction is set to "."; which should be blocking it.
And to make sure I had open_basedir restriction configured correctly; I tried this:
opendir("../");
and sure enough; an error stating that the restriction was on.
Reproduce code:
---------------
<?
chdir("../");
?>
Expected result:
----------------
A PHP error stating that the open_basedir restriction was on
Actual result:
--------------
It worked. No errors at all; and I was able to open the directory with
opendir(getcwd());
after changing the current working directory to the above directory.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 18:00:01 2025 UTC |
Sir, you must not be reading it correctly. I have open_basedir set to "."; which should only allow functions to access files in the current directory and under. I am able to change the directory to an above directory with chdir(); that is NOT a file in the cwd or lower. I can have a script working in System/Files/script.php with open_basedir set to "."; I cannot do include("../anyfile.php"); file("../anyfile.php"); or any other thing that access the above directory... so why can I do chdir("../"); include("anyfile.php"); ? The chdir() function should check to make sure that the directory argument is within the allowed paths of open_basedir; which it doesnt. Hope this clarifys my concern. ~Sean