Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-10-10 14:44:53 +02:00
commit 2118f6a898
2 changed files with 12 additions and 10 deletions

View File

@ -2584,7 +2584,7 @@ static zend_never_inline zend_bool zend_handle_fetch_obj_flags(
}
if (!check_type_array_assignable(prop_info->type)) {
zend_throw_auto_init_in_prop_error(prop_info, "array");
if (result) ZVAL_ERROR(result);
if (result) ZVAL_UNDEF(result);
return 0;
}
}
@ -2600,7 +2600,7 @@ static zend_never_inline zend_bool zend_handle_fetch_obj_flags(
if (Z_TYPE_P(ptr) == IS_UNDEF) {
if (!ZEND_TYPE_ALLOW_NULL(prop_info->type)) {
zend_throw_access_uninit_prop_by_ref_error(prop_info);
if (result) ZVAL_ERROR(result);
if (result) ZVAL_UNDEF(result);
return 0;
}
ZVAL_NULL(ptr);
@ -2641,7 +2641,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
}
zend_throw_non_object_error(container, prop_ptr OPLINE_CC EXECUTE_DATA_CC);
ZVAL_ERROR(result);
ZVAL_UNDEF(result);
return;
} while (0);
}
@ -2728,8 +2728,7 @@ static zend_always_inline void zend_assign_to_property_reference(zval *container
variable_ptr = Z_INDIRECT_P(variable_ptr);
}
/* variable_ptr may be ERROR if fetching the property threw an exception. */
if (UNEXPECTED(Z_ISERROR_P(variable_ptr))) {
if (UNEXPECTED(EG(exception))) {
variable_ptr = &EG(uninitialized_zval);
} else if (UNEXPECTED(Z_TYPE(variable) != IS_INDIRECT)) {
zend_throw_error(NULL, "Cannot assign by reference to overloaded object");

View File

@ -8,17 +8,20 @@ class C {
$c = new C;
echo "\n--> Access non-visible static prop like instance prop:\n";
$c->y =& $ref;
try {
$c->y =& $ref;
} catch (Error $e) {
echo $e, "\n";
}
?>
==Done==
--EXPECTF--
--> Access non-visible static prop like instance prop:
Fatal error: Uncaught Error: Cannot access protected property C::$y in %s:8
Error: Cannot access protected property C::$y in %s:9
Stack trace:
#0 {main}
Next Error: Cannot access protected property C::$y in %s:8
Next Error: Cannot access protected property C::$y in %s:9
Stack trace:
#0 {main}
thrown in %s on line 8
==Done==