ID: 31816 Updated by: [EMAIL PROTECTED] Reported By: mandersm at student dot ethz dot ch -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem Operating System: Fedora (version n/a) PHP Version: 5.0.3 New Comment:
Please search the bugreport, this was submitted before a couple of times, and denied too. Previous Comments: ------------------------------------------------------------------------ [2005-02-02 16:25:32] mandersm at student dot ethz dot ch Hi Derrick, I know that. Why is a thrown exception in __autoload() or one that raises through it fatal? Why can't it raise like any other exception? I guess this is not possible due to the special nature of the __autoload() hook. Nevertheless I think it's a bug (missing feature, if you want), since at the moment any exceptions thrown in code invoked by __autoload() must be caught in __autoload() to prevent a fatal error. I think this narrows the possibilities of creative users. In my special case __autoload() includes files that produce warnings (i.e. deprecated 'var'). Additionally I wrote an error handler which throws exceptions rather than displaying the error. Result: Thrown exception causes fatal error in __autoload, which then again throws an error and makes php crash. I haven't completely analyzed this behaviour yet though. Please reconsider this matter. ------------------------------------------------------------------------ [2005-02-02 16:03:07] [EMAIL PROTECTED] 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 fatal errors can not be caught by your own error handler - no bug here. ------------------------------------------------------------------------ [2005-02-02 15:54:36] mandersm at student dot ethz dot ch 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 this bug report at http://bugs.php.net/?id=31816&edit=1