ID:               44295
 Updated by:       [EMAIL PROTECTED]
 Reported By:      web-php-bugs at sklar dot com
-Status:           Assigned
+Status:           Closed
 Bug Type:         SPL related
 Operating System: OS X 10.4
 PHP Version:      5.2.5
 Assigned To:      colder
 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:
------------------------------------------------------------------------

[2008-02-29 20:52:25] web-php-bugs at sklar dot com

Description:
------------
When set_error_handler() has been used to set a custom error handler,
the RuntimeException thrown by DirectoryIterator::__construct() is not
handled properly -- the user error handler runs and then code continues
after the constructor instead of the exception being thrown.

This is specific to DirectoryIterator, if you replace "$iter = new
DirectoryIterator($dir)" with just "throw new Exception('monkey');" in
the reproduce code below, the catch block executes OK.


Reproduce code:
---------------
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors',true);
$dir = '/this/path/does/not/exist';

set_error_handler('my_error_handler');
function my_error_handler() { print "in error handler\n"; }


try {
    print "before\n";
    $iter = new DirectoryIterator($dir);
    print get_class($iter) . "\n";
    print "after\n";
} catch (Exception $e) {
    print "in catch\n";
}

Expected result:
----------------
before
in catch


Actual result:
--------------
before
in error handler
DirectoryIterator
after



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44295&edit=1

Reply via email to