PHP 4.0 Bug #7396 Updated: is_dir() doesn't work

From: Date: Mon, 23 Oct 2000 07:49:51 +0000
Subject: PHP 4.0 Bug #7396 Updated: is_dir() doesn't work
Groups: php.dev 
Request: Send a blank email to php-dev+get-35844@lists.php.net to get a copy of this message
ID: 7396 Updated by: jmcastagnetto Reported By: whit@transpect.com Status: Open Bug Type: Filesystem function related Assigned To: Comments: I could not reproduce the bug with a modified code, main difference is that I am using the full path in the is_file() function, as it should be. Code below works on PHP 4.0.3pl1 (RedHat 6.1 and Solaris 2.6): $dir ="/path/to/phpdoc/en"; $handle=opendir($dir); while ($file = readdir($handle)) { $retval[count($retval)] = $dir."/".$file; } closedir($handle); sort($retval); $cnt=count($retval); echo "CNT: $cnt\n"; $int=0; while($int<$cnt) { if(is_file($retval[$int])) { echo "File: ".$retval[$int]."\n"; } else { echo "Dir: ".$retval[$int]."\n"; } $int++; } Previous Comments: --------------------------------------------------------------------------- [2000-10-22 19:12:02] whit@transpect.com This snippet works: $handle=opendir($homedir); while ($file = readdir($handle)) { $retval[count($retval)] = $file; } closedir($handle); sort($retval); $cnt=count($retval); echo "CNT: $cnt"; $int=0; while($int<$cnt) { if(!is_dir($retval[$int])) { echo "File: $retval[$int]<br>"; } else { echo "Dir: $retval[$int]<br>"; } $int++; } But if I change "if(!is_dir($retval[$int])) {" to "if(is_file($retval[$int])) {" it fails. The way it fails is that all of the files fail to match as files, and are shown prefixed by "Dir:". --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7396

« previous php.dev (#35844) next »