stas                                     Sun, 16 Jan 2011 21:24:43 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307523

Log:
Fix bug #47143, bug #51458 - provide more useful info in bad exception cases

Bugs: http://bugs.php.net/47143 (Open) Throwing an exception in a destructor 
causes a fatal error
      http://bugs.php.net/51458 (Open) Lack of error context with nested 
exceptions
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/Zend/tests/exception_handler_002.phpt
    U   php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c
    U   php/php-src/trunk/Zend/tests/exception_handler_002.phpt
    U   php/php-src/trunk/Zend/zend_exceptions.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-01-16 20:39:22 UTC (rev 307522)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-01-16 21:24:43 UTC (rev 307523)
@@ -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).

Modified: php/php-src/branches/PHP_5_3/Zend/tests/exception_handler_002.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/exception_handler_002.phpt  
2011-01-16 20:39:22 UTC (rev 307522)
+++ php/php-src/branches/PHP_5_3/Zend/tests/exception_handler_002.phpt  
2011-01-16 21:24:43 UTC (rev 307523)
@@ -20,4 +20,8 @@
 --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

Modified: php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c 2011-01-16 20:39:22 UTC 
(rev 307522)
+++ php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c 2011-01-16 21:24:43 UTC 
(rev 307523)
@@ -91,6 +91,9 @@
                }
        }
        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");
        }


Modified: php/php-src/trunk/Zend/tests/exception_handler_002.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/exception_handler_002.phpt     2011-01-16 
20:39:22 UTC (rev 307522)
+++ php/php-src/trunk/Zend/tests/exception_handler_002.phpt     2011-01-16 
21:24:43 UTC (rev 307523)
@@ -20,4 +20,8 @@
 --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

Modified: php/php-src/trunk/Zend/zend_exceptions.c
===================================================================
--- php/php-src/trunk/Zend/zend_exceptions.c    2011-01-16 20:39:22 UTC (rev 
307522)
+++ php/php-src/trunk/Zend/zend_exceptions.c    2011-01-16 21:24:43 UTC (rev 
307523)
@@ -106,6 +106,9 @@
                }
        }
        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");
        }


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to