1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fixed bug GH-16037 (Assertion failure in ext/date/php_date.c)

This commit is contained in:
Derick Rethans
2024-10-18 11:55:28 +01:00
parent 9bc34182b6
commit b2b294a2b2
3 changed files with 15 additions and 5 deletions

1
NEWS
View File

@@ -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).

View File

@@ -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);
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}

View File

@@ -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