mirror of
https://github.com/php/php-src.git
synced 2026-04-27 01:48:26 +02:00
Merge branch 'PHP-5.6' into PHP-7.0
Conflicts: Zend/zend_exceptions.c
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #70944 (try{ } finally{} can create infinite chains of exceptions)
|
||||
--FILE--
|
||||
<?php
|
||||
$e = new Exception("Bar");
|
||||
try {
|
||||
throw new Exception("Foo", 0, $e);
|
||||
} finally {
|
||||
throw $e;
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Exception: Bar in %sbug70944.php:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %sbug70944.php on line %d
|
||||
@@ -70,7 +70,8 @@ ZEND_API zend_class_entry *zend_get_exception_base(zval *object)
|
||||
|
||||
void zend_exception_set_previous(zend_object *exception, zend_object *add_previous)
|
||||
{
|
||||
zval tmp, *previous, zv, *pzv, rv;
|
||||
zval *previous, *pzv;
|
||||
zval tmp, zv, rv;
|
||||
zend_class_entry *base_ce;
|
||||
|
||||
if (exception == add_previous || !add_previous || !exception) {
|
||||
@@ -81,6 +82,13 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo
|
||||
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);
|
||||
pzv = &zv;
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user