com php-src: Revert "Port the fix of 5.6 to 7.0": Zend/tests/bug70944.phpt Zend/zend_exceptions.c
| From: | Anatol Belski | Date: | Tue, 24 Nov 2015 20:02:26 +0000 |
| Subject: | com php-src: Revert "Port the fix of 5.6 to 7.0": Zend/tests/bug70944.phpt Zend/zend_exceptions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89998@lists.php.net to get a copy of this message | ||
Commit: 74413fe7578b50c6de3b0f9c4966bb0a936a7f17
Author: Anatol Belski <ab@php.net> Tue, 24 Nov 2015 21:02:26 +0100
Parents: dd756ae68364bf531396b8e21978e739395f7650
Branches: PHP-7.0.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=74413fe7578b50c6de3b0f9c4966bb0a936a7f17
Log:
Revert "Port the fix of 5.6 to 7.0"
This reverts commit c2f7fadee2fa176bb020f7833686fbc6cd092bc7.
Changed paths:
M Zend/tests/bug70944.phpt
M Zend/zend_exceptions.c
Diff:
diff --git a/Zend/tests/bug70944.phpt b/Zend/tests/bug70944.phpt
index afb10bc..192fd6d 100644
--- a/Zend/tests/bug70944.phpt
+++ b/Zend/tests/bug70944.phpt
@@ -25,13 +25,13 @@ try {
}
?>
--EXPECTF--
-string(%d) "Exception: Foo in %sbug70944.php:%d
+string(%d) "exception 'Exception' with message 'Foo' in %sbug70944.php:%d
Stack trace:
#0 {main}"
-string(%d) "Exception: Foo in %sbug70944.php:%d
+string(%d) "exception 'Exception' with message 'Foo' in %sbug70944.php:%d
Stack trace:
#0 {main}
-Next Exception: Dummy in %sbug70944.php:%d
+Next exception 'Exception' with message 'Dummy' in %sbug70944.php:%d
Stack trace:
#0 {main}"
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 147fbe8..dd137df 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -70,38 +70,37 @@ ZEND_API zend_class_entry *zend_get_exception_base(zval *object)
void zend_exception_set_previous(zend_object *exception, zend_object *add_previous)
{
- zval *previous, *ancestor, *ex;
- zval pv, zv, rv;
+ zval *previous, *pzv;
+ zval tmp, zv, rv;
zend_class_entry *base_ce;
if (exception == add_previous || !add_previous || !exception) {
return;
}
- ZVAL_OBJ(&pv, add_previous);
- if (!instanceof_function(Z_OBJCE(pv), zend_ce_throwable)) {
+ ZVAL_OBJ(&tmp, add_previous);
+ if (!instanceof_function(Z_OBJCE(tmp), zend_ce_throwable)) {
zend_error_noreturn(E_CORE_ERROR, "Previous exception must implement Throwable");
return;
}
+ pzv = zend_read_property(i_get_exception_base(&tmp), &tmp, "previous",
sizeof("previous")-1, 1, &rv);
+ while (Z_TYPE_P(pzv) == IS_OBJECT) {
+ if (Z_OBJ_P(pzv) == exception) {
+ return;
+ }
+ pzv = zend_read_property(i_get_exception_base(pzv), pzv, "previous",
sizeof("previous")-1, 1, &rv);
+ }
ZVAL_OBJ(&zv, exception);
- ex = &zv;
+ pzv = &zv;
do {
- ancestor = zend_read_property(i_get_exception_base(&pv), &pv, "previous",
sizeof("previous")-1, 1, &rv);
- while (Z_TYPE_P(ancestor) == IS_OBJECT) {
- if (Z_OBJ_P(ancestor) == Z_OBJ_P(ex)) {
- OBJ_RELEASE(add_previous);
- return;
- }
- ancestor = zend_read_property(i_get_exception_base(ancestor), ancestor, "previous",
sizeof("previous")-1, 1, &rv);
- }
- base_ce = i_get_exception_base(ex);
- previous = zend_read_property(base_ce, ex, "previous", sizeof("previous")-1,
1, &rv);
+ base_ce = i_get_exception_base(pzv);
+ previous = zend_read_property(base_ce, pzv, "previous", sizeof("previous")-1,
1, &rv);
if (Z_TYPE_P(previous) == IS_NULL) {
- zend_update_property(base_ce, ex, "previous", sizeof("previous")-1,
&pv);
+ zend_update_property(base_ce, pzv, "previous", sizeof("previous")-1,
&tmp);
GC_REFCOUNT(add_previous)--;
return;
}
- ex = previous;
- } while (Z_OBJ_P(ex) != add_previous);
+ pzv = previous;
+ } while (pzv && Z_OBJ_P(pzv) != add_previous);
}
void zend_exception_save(void) /* {{{ */