#31816 [NEW]: set_exception_handler() does not work for __autoload()
| From: | mandersm at student dot ethz dot ch | Date: | Wed, 02 Feb 2005 14:54:38 +0000 |
| Subject: | #31816 [NEW]: set_exception_handler() does not work for __autoload() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-73273@lists.php.net to get a copy of this message | ||
From: mandersm at student dot ethz dot ch
Operating system: Fedora (version n/a)
PHP version: 5.0.3
PHP Bug Type: Zend Engine 2 problem
Bug description: set_exception_handler() does not work for __autoload()
Description:
------------
When an exception gets thrown in __autoload() my custom error handler is
ignored and a PHP uncaught exception fatal error is displayed instead.
Additionally the occuring fatal error message is not as nice as a regular
uncaught exception error would be (no trace).
This bug *seems* to be related to
http://bugs.php.net/bug.php?id=26591&edit=2
. I am still reporting it,
since it still occurs with the latest snapshot version (20050202133, today
13:30) and is reproduced differently.
My config line:
'./configure' '--with-xslt' '--enable-sockets'
'--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-fastcgi'
'--with-libxml' '--with-openssl' '--enable-ftp' '--with-gd'
'--with-pgsql=/usr/local/pgsql' '--with-zlib-dir=/usr/lib/'
'--disable-cgi' '--disable-magic-quotes' '--with-jpeg-dir=/usr/lib/'
'--with-dom' '--with-dom-xslt'
'--with-mysql=/usr/local/mysql-standard-4.0.23-pc-linux-i686'
No other special changes have been made. XDebug and APC are installed but
*not* enabled in my php.ini.
Reproduce code:
---------------
<?php
function my_handler($e) {
echo 'My custom Handler: '.$e->getMessage().'<br/>';
}
function regular_function() {
throw new Exception('Regular function exception!');
}
function __autoload($class_name) {
throw new Exception('__autoload function exception!');
}
set_exception_handler('my_handler');
/* attempt 1: */ regular_function();
/* attempt 2: */ $test = new Test(); // invoking __autoload()
?>
Expected result:
----------------
attempt 1: 'My custom Handler: Regular function exception!'
attempt 2: 'My custom Handler: __autoload function exception!'
Actual result:
--------------
attempt 1: 'My custom Handler: Regular function exception!'
attempt 2: 'Fatal error: Function __autoload(Test) threw an exception of
type 'Exception' in /home/smartloader/htdocs/proof.php on line 22'
--
Edit bug report at http://bugs.php.net/?id=31816&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31816&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31816&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31816&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31816&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31816&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31816&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31816&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31816&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31816&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31816&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31816&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31816&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31816&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31816&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31816&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31816&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31816&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31816&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31816&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31816&r=mysqlcfg