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.
Fatal error: Uncaught Error: Cannot access private property B::$x in %s:%d
Stack trace:
#0 %s(%d): Closure->{closure}()
-#1 {main}
-
-Next Error: Cannot access private property B::$x in %s:%d
-Stack trace:
-#0 %s(%d): Closure->{closure}()
#1 {main}
thrown in %s on line %d
Fatal error: Uncaught Error: Cannot access private property B::$x in %s:%d
Stack trace:
#0 %s(%d): Closure->{closure}()
-#1 {main}
-
-Next Error: Cannot access private property B::$x in %s:%d
-Stack trace:
-#0 %s(%d): Closure->{closure}()
#1 {main}
thrown in %s on line %d
}
return;
}
+ } else if (UNEXPECTED(Z_ISERROR_P(ptr))) {
+ ZVAL_ERROR(result);
+ return;
}
ZVAL_INDIRECT(result, ptr);
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");
zobj = Z_OBJ_P(object);
name = zval_try_get_tmp_string(member, &tmp_name);
if (UNEXPECTED(!name)) {
- return NULL;
+ return &EG(error_zval);
}
#if DEBUG_OBJECT_HANDLERS
zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
}
+ } else if (zobj->ce->__get == NULL) {
+ retval = &EG(error_zval);
}
zend_tmp_string_release(tmp_name);
==Done==
--EXPECTF--
--> Access non-visible static prop like instance prop:
-Error: Cannot access protected property C::$y in %s:9
-Stack trace:
-#0 {main}
-
-Next Error: Cannot access protected property C::$y in %s:9
+Error: Cannot access protected property C::$y in %s:%d
Stack trace:
#0 {main}
==Done==