Skip to content

Commit a66e226

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix DatePeriod property handling with indirect modification
2 parents 2dc5077 + 01d30f8 commit a66e226

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

ext/date/php_date.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5059,15 +5059,18 @@ static zval *date_period_write_property(zend_object *object, zend_string *name,
50595059
return value;
50605060
}
50615061

5062-
std_object_handlers.write_property(object, name, value, cache_slot);
5063-
return value;
5062+
return zend_std_write_property(object, name, value, cache_slot);
50645063
}
50655064
/* }}} */
50665065

50675066
/* {{{ date_period_get_property_ptr_ptr */
5068-
static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot)
5067+
static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot)
50695068
{
5070-
/* Fall back to read_property handler. */
5071-
return NULL;
5069+
if (date_period_is_magic_property(name)) {
5070+
zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name));
5071+
return &EG(error_zval);
5072+
}
5073+
5074+
return zend_std_get_property_ptr_ptr(object, name, type, cache_slot);
50725075
}
50735076
/* }}} */

ext/date/tests/bug65672.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ $period->dynamic2 = [];
2828
$period->dynamic2[] = "array";
2929
var_dump($period->dynamic2);
3030

31+
$period->dynamic3[] = "array";
32+
var_dump($period->dynamic3);
33+
3134
?>
3235
--EXPECT--
3336
string(5) "stuff"
@@ -42,3 +45,7 @@ array(1) {
4245
[0]=>
4346
string(5) "array"
4447
}
48+
array(1) {
49+
[0]=>
50+
string(5) "array"
51+
}

0 commit comments

Comments
 (0)