diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e26d16ec2b3..e9b077ca141 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -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); } /* }}} */ diff --git a/ext/date/tests/bug65672.phpt b/ext/date/tests/bug65672.phpt index a84cff69ae9..a01287d9b4c 100644 --- a/ext/date/tests/bug65672.phpt +++ b/ext/date/tests/bug65672.phpt @@ -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" +}