Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix DatePeriod property handling with indirect modification
This commit is contained in:
Nikita Popov 2020-01-30 13:14:29 +01:00
commit a66e226713
2 changed files with 15 additions and 5 deletions

View File

@ -5059,15 +5059,18 @@ static zval *date_period_write_property(zend_object *object, zend_string *name,
return value;
}
std_object_handlers.write_property(object, name, value, cache_slot);
return value;
return zend_std_write_property(object, name, value, cache_slot);
}
/* }}} */
/* {{{ date_period_get_property_ptr_ptr */
static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot)
static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
{
/* Fall back to read_property handler. */
return NULL;
if (date_period_is_magic_property(name)) {
zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name));
return &EG(error_zval);
}
return zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
}
/* }}} */

View File

@ -28,6 +28,9 @@ $period->dynamic2 = [];
$period->dynamic2[] = "array";
var_dump($period->dynamic2);
$period->dynamic3[] = "array";
var_dump($period->dynamic3);
?>
--EXPECT--
string(5) "stuff"
@ -42,3 +45,7 @@ array(1) {
[0]=>
string(5) "array"
}
array(1) {
[0]=>
string(5) "array"
}