diff --git a/Zend/tests/bug73156.phpt b/Zend/tests/bug73156.phpt index b5092514a03..327ad9e4310 100644 --- a/Zend/tests/bug73156.phpt +++ b/Zend/tests/bug73156.phpt @@ -1,5 +1,5 @@ --TEST-- -iBug #73156 (segfault on undefined function) +Bug #73156 (segfault on undefined function) --FILE-- +--EXPECTF-- +Exception::__set_state(array( + 'message' => '', + 'string' => 'Exception in %sbug73350.php:%d +Stack trace: +#0 {main}', + 'code' => 0, + 'file' => '%sbug73350.php', + 'line' => %d, + 'trace' => + array ( + ), + 'previous' => NULL, +)) diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 331213d8e64..8f41e1ce713 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -740,14 +740,15 @@ ZEND_METHOD(exception, __toString) Z_OBJPROP_P(exception)->u.v.nApplyCount++; exception = GET_PROPERTY(exception, ZEND_STR_PREVIOUS); if (exception && Z_TYPE_P(exception) == IS_OBJECT && Z_OBJPROP_P(exception)->u.v.nApplyCount > 0) { - exception = NULL; + break; } } zend_string_release(fname); + exception = getThis(); /* Reset apply counts */ while (exception && Z_TYPE_P(exception) == IS_OBJECT && (base_ce = i_get_exception_base(exception)) && instanceof_function(Z_OBJCE_P(exception), base_ce)) { - if(Z_OBJPROP_P(exception)->u.v.nApplyCount) { + if (Z_OBJPROP_P(exception)->u.v.nApplyCount) { Z_OBJPROP_P(exception)->u.v.nApplyCount--; } else { break;