Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PHP NEWS
- Date:
. Fixed bug GH-16454 (Unhandled INF in date_sunset() with tiny $utcOffset).
(cmb)
. Fixed bug GH-16037 (Assertion failure in ext/date/php_date.c). (Derick)

- DOM:
. Fixed bug GH-16316 (DOMXPath breaks when not initialized properly).
Expand Down
10 changes: 5 additions & 5 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,7 @@ static void add_common_properties(HashTable *myht, zend_object *zobj)

common = zend_std_get_properties(zobj);

ZEND_HASH_MAP_FOREACH_STR_KEY_VAL_IND(common, name, prop) {
ZEND_HASH_FOREACH_STR_KEY_VAL_IND(common, name, prop) {
if (zend_hash_add(myht, name, prop) != NULL) {
Z_TRY_ADDREF_P(prop);
}
Expand Down Expand Up @@ -2840,7 +2840,7 @@ static void restore_custom_datetime_properties(zval *object, HashTable *myht)
zend_string *prop_name;
zval *prop_val;

ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
ZEND_HASH_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
if (!prop_name || (Z_TYPE_P(prop_val) == IS_REFERENCE) || date_time_is_internal_property(prop_name)) {
continue;
}
Expand Down Expand Up @@ -3883,7 +3883,7 @@ static void restore_custom_datetimezone_properties(zval *object, HashTable *myht
zend_string *prop_name;
zval *prop_val;

ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
ZEND_HASH_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
if (!prop_name || (Z_TYPE_P(prop_val) == IS_REFERENCE) || date_timezone_is_internal_property(prop_name)) {
continue;
}
Expand Down Expand Up @@ -4512,7 +4512,7 @@ static void restore_custom_dateinterval_properties(zval *object, HashTable *myht
zend_string *prop_name;
zval *prop_val;

ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
ZEND_HASH_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
if (!prop_name || (Z_TYPE_P(prop_val) == IS_REFERENCE) || date_interval_is_internal_property(prop_name)) {
continue;
}
Expand Down Expand Up @@ -5504,7 +5504,7 @@ static void restore_custom_dateperiod_properties(zval *object, HashTable *myht)
zend_string *prop_name;
zval *prop_val;

ZEND_HASH_MAP_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
ZEND_HASH_FOREACH_STR_KEY_VAL(myht, prop_name, prop_val) {
if (!prop_name || (Z_TYPE_P(prop_val) == IS_REFERENCE) || date_period_is_internal_property(prop_name)) {
continue;
}
Expand Down
9 changes: 9 additions & 0 deletions ext/date/tests/bug-gh16037.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
Test for bug GH-16037: Assertion failure in ext/date/php_date.c
--FILE--
<?php
$di = (new DateInterval('P1Y'))->__unserialize([[]]);
echo gettype($di);
?>
--EXPECT--
NULL
Loading