ID:               35635
 Updated by:       [EMAIL PROTECTED]
 Reported By:      plesek at nln dot cz
-Status:           Open
+Status:           Bogus
 Bug Type:         Directory function related
 Operating System: Windows XP Professional SP2
 PHP Version:      4.4.1
 New Comment:

Did you try to see what's in the $element?
Of course it doesn't work, you need to do it this way:
is_dir("./whatever/".$element);

No bug here.


Previous Comments:
------------------------------------------------------------------------

[2005-12-11 21:54:18] plesek at nln dot cz

Description:
------------
The behavior of following code is rather unpredictable. In the case of
opendir("."), all works perfecty, but if you add something like
/anotherdir, then you run into problems. In this example, let's assume
we have dir structure ./whatever/ with another 2 folders and files. The
result CAN be, as following, but it happened to me, that all dirs were
recognized correctly or for example only one was. Only special dirs, .
and .. are recognized. I tried several tips, that were on the internet,
like ending slash, or backslashes instead of normal ones (windows), with
no result. And on different folders, again the same, with minor
fluctuations, as mentioned above.
And as for is_file, te result will be all false in any case, tried
several times.Again, it applies only for other directories, than "."
All extensions disabled,of course.

Reproduce code:
---------------
$handler=opendir("./whatever");
while($element=readdir($handler)) {
$tmp=is_dir($element);
var_dump($tmp);
echo " $element<br/>";
}

Expected result:
----------------
bool(true) dir1
bool(true) dir2
bool(false) file1.txt
bool(false) file2.txt

Actual result:
--------------
bool(false) dir1
bool(false) dir2
bool(false) file1.txt
bool(false) file2.txt


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35635&edit=1

Reply via email to