From 5a076e670a13decf76524e6f0c13abfce5532021 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 10 Oct 2019 15:14:04 +0200 Subject: Return error_zval form get_property_ptr_ptr on exception This goes in the reverse direction of 4463acb9513dfb62206760c49b3da1fe4d92f40a. After looking around a bit, it seems that we already check for Z_ISERROR_P() on the get_property_ptr_ptr return value in other places. So do this in zend_fetch_property_address() as well, and also make sure that EG(error_zval) is indeed returned on exception in get_property_ptr_ptr. In particular, this fixes the duplicate exceptions that we used to get because first get_property_ptr_ptr threw one and then read_property throws the same exception again. --- Zend/zend_execute.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Zend/zend_execute.c') diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 368d6b2dcc..04aa3fee6e 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2822,6 +2822,9 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c } return; } + } else if (UNEXPECTED(Z_ISERROR_P(ptr))) { + ZVAL_ERROR(result); + return; } ZVAL_INDIRECT(result, ptr); @@ -2858,7 +2861,7 @@ static zend_always_inline void zend_assign_to_property_reference(zval *container variable_ptr = Z_INDIRECT_P(variable_ptr); } - if (UNEXPECTED(Z_ISERROR_P(variable_ptr) || EG(exception))) { + if (UNEXPECTED(Z_ISERROR_P(variable_ptr))) { variable_ptr = &EG(uninitialized_zval); } else if (UNEXPECTED(Z_TYPE(variable) != IS_INDIRECT)) { zend_throw_error(NULL, "Cannot assign by reference to overloaded object"); -- cgit v1.2.1