From: Stanislav Malyshev Date: Sun, 16 Jan 2011 21:24:43 +0000 (+0000) Subject: Fix bug #47143, bug #51458 - provide more useful info in bad exception cases X-Git-Tag: php-5.3.6RC1~117 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff4982784a53f02b08b1b2cade9dff6e46977eca;p=php Fix bug #47143, bug #51458 - provide more useful info in bad exception cases --- diff --git a/NEWS b/NEWS index 34f08317eb..3d72f72d51 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,9 @@ in method. (Scott) . Added options to debug backtrace functions. (Stas) . Fixed Bug #53629 (memory leak inside highlight_string()). (Hannes, Ilia) + . Fixed Bug #51458 (Lack of error context with nested exceptions). (Stas) + . Fixed Bug #47143 (Throwing an exception in a destructor causes a fatal error). + (Stas) - Core: . Fixed bug #48484 (array_product() always returns 0 for an empty array). diff --git a/Zend/tests/exception_handler_002.phpt b/Zend/tests/exception_handler_002.phpt index 3e0e4f00dd..7dfbb38fd1 100644 --- a/Zend/tests/exception_handler_002.phpt +++ b/Zend/tests/exception_handler_002.phpt @@ -20,4 +20,8 @@ echo "Done\n"; --EXPECTF-- string(12) "test thrown!" -Fatal error: Exception thrown without a stack frame in Unknown on line 0 +Fatal error: Uncaught exception 'Exception' in %sexception_handler_002.php:7 +Stack trace: +#0 [internal function]: foo(Object(test)) +#1 {main} + thrown in %sexception_handler_002.php on line %d diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 261e3111b6..95ff0ab178 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -91,6 +91,9 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */ } } if (!EG(current_execute_data)) { + if(EG(exception)) { + zend_exception_error(EG(exception), E_ERROR TSRMLS_CC); + } zend_error(E_ERROR, "Exception thrown without a stack frame"); }