ID:               31102
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php_nospam at ramihyn dot sytes dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows 2000 SP4
 PHP Version:      5.0.2
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

__autoload is the last resort for the engine if it is looking for a
class. If it can not be found it is seen as a fatal error (ie "class
not found") and the script is aborted. This also happens when you throw
an exception to signal that the class could not be loaded.


Previous Comments:
------------------------------------------------------------------------

[2004-12-15 21:07:30] php_nospam at ramihyn dot sytes dot net

Description:
------------
The code below prints a fatal error. This is incorrect as the 
throwing of the exception is supposed to bring us 
immediately to the catch block. Its also inconsistent because when i
replace the $bug = new Bug(); by __autoload("Bug"); the exception is
handled correctly. Code following the throw is not executed, as
expected.

Reproduce code:
---------------
function __autoload($class)
{
        throw new Exception();
}

try
{
        $bug = new Bug(); // Results in a fatal error
        #__autoload("Bug"); // Prints "exception caught."
}
catch (Exception $e)
{
        echo "exception caught.";
}


Expected result:
----------------
exception caught.

Actual result:
--------------
Fatal error: Function __autoload(Bug) threw an exception of type
'Exception' in D:\y\index.php on line 7


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


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

Reply via email to