#36064 [Asn->Bgs]: RecursiveDirectoryIterator::hasChildren 's problem

From: Date: Wed, 18 Jan 2006 09:01:38 +0000
Subject: #36064 [Asn->Bgs]: RecursiveDirectoryIterator::hasChildren 's problem
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92117@lists.php.net to get a copy of this message
ID: 36064 Updated by: helly@php.net Reported By: sqchen at citiz dot net -Status: Assigned +Status: Bogus Bug Type: SPL related -Operating System: redhat 7.3 +Operating System: * -PHP Version: 5.1.2 +PHP Version: 5.* Assigned To: helly New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You don't check valid(). In general no iterator method must be used when valid() returns false. Previous Comments: ------------------------------------------------------------------------ [2006-01-18 09:43:36] sniper@php.net Assigned to the maintainer. ------------------------------------------------------------------------ [2006-01-18 07:11:28] sqchen at citiz dot net Description: ------------ php manual says RecursiveDirectoryIterator::hasChildren() Returns whether current entry is a directory and not '.' or '..' () Reproduce code: --------------- <?php $obj = new RecursiveDirectoryIterator("bbb"); $obj->rewind(); for($i=0;$i<5;$i++){ var_dump($obj->key()); var_dump($obj->hasChildren()); $obj->next(); } ?> directory bbb included: 1.txt ccc p.txt //ccc is a directory Expected result: ---------------- string(9) "bbb/1.txt" bool(false) string(7) "bbb/ccc" bool(true) string(9) "bbb/p.txt" bool(false) string(4) "bbb/" bool(false) string(4) "bbb/" bool(false) Actual result: -------------- string(9) "bbb/1.txt" bool(false) string(7) "bbb/ccc" bool(true) string(9) "bbb/p.txt" bool(false) string(4) "bbb/" bool(true) string(4) "bbb/" bool(true) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36064&edit=1

« previous php.bugs (#92117) next »