note 76513 added to function.is-dir
| From: | danr at c13-ss-2-lb dot cnet dot com | Date: | Wed, 18 Jul 2007 21:54:14 +0000 |
| Subject: | note 76513 added to function.is-dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128701@lists.php.net to get a copy of this message | ||
Running PHP 5.2.0 on Apache Windows, I had a problem (likely the same one as described by others)
where is_dir returned a False for directories with certain permissions even though they were
accessible.
Strangely, I was able to overcome the problem with a more complete path. For example, this only
displays "Works" on subdirectories with particular permissions (in this directory about 1
out of 3):
$d = opendir("./albums/mydir");
while(false !== ($f = readdir($d))) {
echo "<hr />";
if(is_dir($f)) {
echo "<b>Works:" . $f . "</b>";
}
}
However, this works properly for all directories:
$d = opendir("./albums/mydir");
while(false !== ($f = readdir($d))) {
echo "<hr />";
$dName = "./albums/mydir/" . $f;
if(is_dir($dName)) {
echo "<b>Works:" . $dName . "</b>";
}
}
I don't understand the hit-and-miss of the first code, but maybe the second code can help
others having this problem.
----
Server IP: 69.147.83.197
Probable Submitter: 76.168.45.126
----
Manual Page -- http://www.php.net/manual/en/function.is-dir.php
Edit -- https://master.php.net/note/edit/76513
Del: integrated -- https://master.php.net/note/delete/76513/integrated
Del: useless -- https://master.php.net/note/delete/76513/useless
Del: bad code -- https://master.php.net/note/delete/76513/bad+code
Del: spam -- https://master.php.net/note/delete/76513/spam
Del: non-english -- https://master.php.net/note/delete/76513/non-english
Del: in docs -- https://master.php.net/note/delete/76513/in+docs
Del: other reasons-- https://master.php.net/note/delete/76513
Reject -- https://master.php.net/note/reject/76513
Search -- https://master.php.net/manage/user-notes.php