no Exception throwed out when pass "" to DirectoryIterator construct
| Bug #36134 | no Exception throwed out when pass "" to DirectoryIterator construct | ||||
|---|---|---|---|---|---|
| Submitted: | 2006-01-23 10:15 UTC | Modified: | 2006-01-23 16:24 UTC | ||
| From: | quick_defect at yahoo dot com | Assigned: | helly (profile) | ||
| Status: | Closed | Package: | SPL related | ||
| PHP Version: | 5.1.2 | OS: | redhat | ||
| Private report: | No | CVE-ID: | None | ||
[2006-01-23 10:15 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-01-23 16:24 UTC] iliaa@php.net