diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-10 15:14:04 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-10-10 15:14:04 +0200 |
commit | 5a076e670a13decf76524e6f0c13abfce5532021 (patch) | |
tree | c5b713ea38e08e85853c3c3c9b52d89c06bc4dd6 /Zend/zend_execute.c | |
parent | 4463acb9513dfb62206760c49b3da1fe4d92f40a (diff) | |
download | php-git-5a076e670a13decf76524e6f0c13abfce5532021.tar.gz |
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.
Diffstat (limited to 'Zend/zend_execute.c')
-rw-r--r-- | Zend/zend_execute.c | 5 |
1 files changed, 4 insertions, 1 deletions
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"); |