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

Merge branch 'PHP-8.4' into PHP-8.5

* PHP-8.4:
  Fix GH-20936: DatePeriod::__set_state() cannot handle null start
This commit is contained in:
ndossche
2026-02-04 18:35:29 +01:00
3 changed files with 20 additions and 2 deletions

4
NEWS
View File

@@ -14,6 +14,10 @@ PHP NEWS
. Fixed bug GH-20504 (Assertion failure in zend_get_property_guard when
accessing properties on Reflection LazyProxy via isset()). (Arnaud)
- Date:
. Fixed bug GH-20936 (DatePeriod::__set_state() cannot handle null start).
(ndossche)
- DOM:
. Fixed bug GH-21077 (Accessing Dom\Node::baseURI can throw TypeError).
(ndossche)

View File

@@ -5749,7 +5749,7 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, con
php_date_obj *date_obj;
date_obj = Z_PHPDATE_P(ht_entry);
if (!date_obj->time) {
if (!date_obj->time || !period_obj->start_ce) {
return 0;
}
@@ -5770,7 +5770,7 @@ static bool php_date_period_initialize_from_hash(php_period_obj *period_obj, con
php_date_obj *date_obj;
date_obj = Z_PHPDATE_P(ht_entry);
if (!date_obj->time) {
if (!date_obj->time || !period_obj->start_ce) {
return 0;
}

View File

@@ -0,0 +1,14 @@
--TEST--
GH-20936 (DatePeriod::__set_state() cannot handle null start)
--FILE--
<?php
$end = new DateTime('2022-07-16', new DateTimeZone('UTC'));
$interval = new DateInterval('P2D');
try {
DatePeriod::__set_state(['start' => null, 'end' => $end, 'current' => null, 'interval' => $interval, 'recurrences' => 2, 'include_start_date' => false, 'include_end_date' => true]);
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), "\n";
}
?>
--EXPECT--
Error: Invalid serialization data for DatePeriod object