#31102 [NEW]: Exception not handled when thrown inside __autoload()
| From: | php_nospam at ramihyn dot sytes dot net | Date: | Wed, 15 Dec 2004 20:07:31 +0000 |
| Subject: | #31102 [NEW]: Exception not handled when thrown inside __autoload() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-70281@lists.php.net to get a copy of this message | ||
From: php_nospam at ramihyn dot sytes dot net
Operating system: Windows 2000 SP4
PHP version: 5.0.2
PHP Bug Type: Zend Engine 2 problem
Bug description: Exception not handled when thrown inside __autoload()
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 bug report at http://bugs.php.net/?id=31102&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31102&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31102&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31102&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31102&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31102&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31102&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31102&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31102&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31102&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31102&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31102&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31102&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31102&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31102&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31102&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31102&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31102&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31102&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31102&r=mysqlcfg