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.4.0alpha1~191^2~369 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c1ba13d3b02d8aa72e8932429b099b0159a7e3f;p=php Fix bug #47143, bug #51458 - provide more useful info in bad exception cases --- 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 28d2063031..0865815c95 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -106,6 +106,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"); }