Re: Re: PHP 4.0 Bug #7396 Updated: is_dir() doesn't work
| From: | Andi Gutmans | Date: | Fri, 27 Oct 2000 10:54:18 +0000 |
| Subject: | Re: Re: PHP 4.0 Bug #7396 Updated: is_dir() doesn't work | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-36151@lists.php.net to get a copy of this message | ||
Can you explain the problem again without long examples? (Two lines if possible).
What doesn't work?
Andi
At 11:07 PM 10/26/00 -0400, Whit wrote:
Yeah, as I already responded a couple days back, the full path fixes it. The thing is until about halfway through the 3.x series this was not required ... looks like folks besides me do get confused on it, you may want to be explicit in the manual. Whit On Fri, Oct 27, 2000 at 12:12:11PM -0000, Bug Database wrote: ID: 7396 Updated by: sniper Reported By: whit@transpect.com Status: Feedback Bug Type: Filesystem function related Assigned To: Comments: Please check the example Jesus gave. And report back whether it solves this or not. --Jani Previous Comments: --------------------------------------------------------------------------- [2000-10-23 03:49:50] jmcastagnetto@php.net 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)) {--- Andi Gutmans <andi@zend.com> http://www.zend.com/$retval[count($retval)] = $dir."/".$file;} closedir($handle); sort($retval); $cnt=count($retval); echo "CNT: $cntn"; $int=0; while($int<$cnt) { if(is_file($retval[$int])) {echo "File: ".$retval[$int]."n";} else {echo "Dir: ".$retval[$int]."n";} $int++; } --------------------------------------------------------------------------- [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 -- \/\/ I-I I T Blauvelt whit@transpect.com -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net