#36134 [Asn->Csd]: no Exception throwed out when pass "" to DirectoryIterator construct
ID: 36134
Updated by: iliaa@php.net
Reported By: quick_defect at yahoo dot com
-Status: Assigned
+Status: Closed
Bug Type: SPL related
Operating System: redhat
PHP Version: 5.1.2
Assigned To: helly
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-01-23 15:26:22] sniper@php.net
Assigned to the maintainer.
------------------------------------------------------------------------
[2006-01-23 10:15:44] quick_defect at yahoo dot com
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36134&edit=1
Thread (3 messages)