com php-src: Fixed bug #73067 (__debugInfo crashes wh en throwing an exception): NEWS Zend/tests/bug7 3067.phpt Zend/zend_object_handlers.c
| From: | Xinchen Hui | Date: | Tue, 13 Sep 2016 02:58:57 +0000 |
| Subject: | com php-src: Fixed bug #73067 (__debugInfo crashes wh en throwing an exception): NEWS Zend/tests/bug7 3067.phpt Zend/zend_object_handlers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94438@lists.php.net to get a copy of this message | ||
Commit: 2d8ab51576695630a7471ff829cc5ea10becdc0f
Author: Xinchen Hui <laruence@gmail.com> Tue, 13 Sep 2016 10:58:57 +0800
Parents: 2302eef5c93b722d5311549dd59d495ff11d3b0d
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2d8ab51576695630a7471ff829cc5ea10becdc0f
Log:
Fixed bug #73067 (__debugInfo crashes when throwing an exception)
Bugs:
https://bugs.php.net/73067
Changed paths:
M NEWS
A Zend/tests/bug73067.phpt
M Zend/zend_object_handlers.c
Diff:
diff --git a/NEWS b/NEWS
index efae2e4..1e2d599 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
?? ??? 2016 PHP 7.0.12
- Core:
+ . Fixed bug #73067 (__debugInfo crashes when throwing an exception).
+ (Laruence)
. Fixed bug #73025 (Heap Buffer Overflow in virtual_popen of
zend_virtual_cwd.c). (cmb)
. Fixed bug #72703 (Out of bounds global memory read in BF_crypt triggered by
diff --git a/Zend/tests/bug73067.phpt b/Zend/tests/bug73067.phpt
new file mode 100644
index 0000000..f5d34a8
--- /dev/null
+++ b/Zend/tests/bug73067.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #73067 (__debugInfo crashes when throwing an exception)
+--FILE--
+<?php
+
+class Debug
+{
+ public function __debugInfo()
+ {
+ throw new Exception("Test Crash");
+ }
+}
+
+try {
+ var_dump(new Debug());
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECTF--
+Fatal error: __debuginfo() must return an array in %sbug73067.php on line %d
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 70dab66..39c4d3d 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -182,6 +182,7 @@ ZEND_API HashTable *zend_std_get_debug_info(zval *object, int *is_temp) /* {{{ *
return ht;
}
+ zend_clear_exception();
zend_error_noreturn(E_ERROR, ZEND_DEBUGINFO_FUNC_NAME "() must return an array");
return NULL; /* Compilers are dumb and don't understand that noreturn means that the function
does NOT need a return value... */