From: krzysztof dot talajko at gmail dot com Operating system: Windows 7 RC PHP version: 5.2.11 PHP Bug Type: Scripting Engine problem Bug description: Throw exception fails in __autoload() implementation
Description: ------------ Throw exception in __autoload() implementation is impossible. Instead fatal error "Class (...) not found" is reported. Reproduce code: --------------- <?php function loader($class) { @include_once($class.'.php'); if (!class_exists($class, false)) { throw new Exception("Class ".$class." not found"); } } spl_autoload_register('loader'); try{ class FooClass extends Some_Not_Existing_Class {} } catch (Exception $e) { echo "Caught load class failed exception (".$e->getMessage().")."; } Expected result: ---------------- Caught load class failed exception (Class Some_Not_Existing_Class not found). Actual result: -------------- Fatal error: Class 'Some_Not_Existing_Class' not found in C:\dev\workspace\foo.php on line 19 -- Edit bug report at http://bugs.php.net/?id=50246&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50246&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50246&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50246&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50246&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50246&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50246&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50246&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50246&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50246&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50246&r=support Expected behavior: http://bugs.php.net/fix.php?id=50246&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50246&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50246&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50246&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50246&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50246&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50246&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50246&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50246&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50246&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50246&r=mysqlcfg