Fix DatePeriod property handling with indirect modification

We do need to implement get_property_ptr_ptr to make arrays work
correctly.
This commit is contained in:
Nikita Popov 2020-01-30 13:09:15 +01:00
parent dfbeee034a
commit 01d30f880a
2 changed files with 17 additions and 4 deletions

View File

@ -5423,15 +5423,21 @@ static zval *date_period_write_property(zval *object, zval *member, zval *value,
}
zend_string_release(name);
std_object_handlers.write_property(object, member, value, cache_slot);
return value;
return zend_std_write_property(object, member, value, cache_slot);
}
/* }}} */
/* {{{ date_period_get_property_ptr_ptr */
static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot)
{
/* Fall back to read_property handler. */
return NULL;
zend_string *name = zval_get_string(member);
if (date_period_is_magic_property(name)) {
zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name));
zend_string_release(name);
return &EG(error_zval);
}
zend_string_release(name);
return zend_std_get_property_ptr_ptr(object, member, 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"
}