|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-01-13 14:43 UTC] daniel at lorch dot cc
I hope this is not just a configuration problem. We have safe_mode turned on and all file-system functions ARE limited by safe_mode - only readdir() doesn't seem to be. Would anyone mind to have a look at this? I have provided a sample script so it shouldn't take long to test it with your configuration:
----------------------------------
<?php
function list_dir($dir) {
$h = @opendir($dir);
if(!$h)
return false;
while($e = readdir($h)) {
$p = $dir . '/' . $e;
if($p != '.' && $p != '..')
if(is_dir($p))
echo '[DIR] ', $e, "<br>\n";
else
echo $e, "<br>\n";
}
closedir($h);
}
list_dir($QUERY_STRING);
?>
----------------------------------
just save this file as for example "dir.php" and run with
dir.php?/home/customer/
to list contents. I looked at the release announcement of 4.1.1 and there was no description of this bug:
http://www.php.net/release_4_1_1.php
I also looked through the existing bug database and found nothing about it. Excuse me if it's a dupe or even a bogus.
Kind Regards,
Daniel Lorch
http://daniel.lorch.cc/
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 16:00:01 2025 UTC |
Danielsan is right... i have had a short look into the sourcecode (ext/standard/dir.c) and compared chdir-function with opendir-function. In PHP_FUNCTION(chdir) i found this three-liner which seems to be a safe_mode-Check: ------------------------- if (PG(safe_mode) && !php_checkuid((*arg)->value.str.val, NULL, CHECKUI$ RETURN_FALSE; } ------------------------- PHP_FUNCTION(opendir) (or _php_do_opendir() to which this function refers) does not have such a check, just a short open_basedir-Check. Oh, btw, it seems for me that chdir doesn't do a open_basedir-Check but i may be wrong. cu, Roland PS: All what i said is just 'imho' and 'afaik' because i do not have many expiences with C!