php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6151 The function is_dir seems to behave wrong
Submitted: 2000-08-14 15:03 UTC Modified: 2000-08-14 17:09 UTC
From: cedric dot schaller at sonar dot ch Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0.0 OS: Solaris 5
Private report: No CVE-ID: None
 [2000-08-14 15:03 UTC] cedric dot schaller at sonar dot ch
<?
$path="$DOCUMENT_ROOT/site/documents";
$current_dir=opendir($path);
while ($file=readdir($current_dir)) {
	if (is_dir($file))
		echo "dir";
       	if ($file != "." && $file != "..")
        		echo "$file\n"; 
        	if (is_dir($file) && $file != "." && $file != "..")
        		echo "$file\n"; 

}
?>

In this program, I have 3 "if conditions". The 3rd is actually the two first put together. But the 2 first are evaluated as true and the third as wrong. 

Thanks for having a look at it. 

Cedric Schaller

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 16:01:35 2024 UTC