From:             quick_defect at yahoo dot com
Operating system: redhat
PHP version:      5.1.2
PHP Bug Type:     SPL related
Bug description:  no Exception throwed out when pass "" to DirectoryIterator 
construct

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 bug report at http://bugs.php.net/?id=36134&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36134&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36134&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36134&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36134&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36134&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36134&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36134&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36134&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36134&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36134&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36134&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36134&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36134&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36134&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36134&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36134&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36134&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36134&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36134&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36134&r=mysqlcfg

Reply via email to