mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
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:
parent
dfbeee034a
commit
01d30f880a
@ -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);
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user