From: acm at tweakers dot net
Operating system: Linux
PHP version: 5.0.0b2 (beta2)
PHP Bug Type: Zend Engine 2 problem
Bug description: Exceptions from within _autoload cannot be caught
Description:
------------
When You try to implement some sort of class-loader, the autoload-function
is very usefull.
But as soon as you want the user-code to do something special when a class
isn't found, it'd be handy to throw out an exception, which the user-code
either can catch or ignore.
With the current beta2 that isn't possible as it seems.
Reproduce code:
---------------
<?
function __autoload($class)
{
throw new Exception($class . " does not exist.");
}
try
{
$obj = new test(); // Where test is a non-existent class
}
catch(Exception $e)
{
echo $e;
}
?>
Expected result:
----------------
Something like:
exception 'exception' with message 'test does not exist.' etc..
Actual result:
--------------
Fatal error: __autoload threw an exception in
/home/acm/public_html/kb/autoload.php on line 11
--
Edit bug report at http://bugs.php.net/?id=26193&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26193&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26193&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26193&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26193&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26193&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=26193&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26193&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26193&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26193&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26193&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26193&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26193&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26193&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26193&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26193&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26193&r=float