|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-01-23 15:26 UTC] sniper@php.net
[2006-01-23 16:24 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 15:00:02 2025 UTC |
Description: ------------ when I use DirectoryIterator::__construct to get a new DirectoryIterator, I found it do not throw exception when "" and NULL passed as argument. Reproduce code: --------------- <?php $max=mt_getrandmax(); $ar=array(1,2,3); $ite=new RecursiveArrayIterator($ar); $invalid=array("",new Exception,array(),$ite,$max+1,NULL,"/no/such/dir"); foreach($invalid as $p) { try { $ak=new DirectoryIterator($p); var_dump($ak->valid()); var_dump($ak->getPathname()); echo "I will never come out\n"; }catch(Exception $e) { echo "exception caught with parameter $p\n"; } } ?> Expected result: ---------------- exception caught with parameter "" exception caught with parameter Object id #2 exception caught with parameter Array exception caught with parameter Object id #1 exception caught with parameter 2147483648 exception caught with parameter NULL exception caught with parameter /no/such/dir Actual result: -------------- bool(false) bool(false) I will never come out exception caught with parameter Object id #2 exception caught with parameter Array exception caught with parameter Object id #1 exception caught with parameter 2147483648 bool(false) bool(false) I will never come out exception caught with parameter /no/such/dir