Skip to content
Open
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
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ PHP NEWS
. Fixed bug GH-15375 (Nested "yield from" skips items after a valid() or
next() call on the inner generator). (iliaal)

- Intl:
. Fixed a double-free when IntlGregorianCalendar construction fails after
the ICU constructor adopts the TimeZone. (iliaal)

- Opcache:
. Fixed opcache.protect_memory race under ZTS. (realFlowControl)

Expand Down
1 change: 0 additions & 1 deletion ext/intl/calendar/gregoriancalendar_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ static void _php_intlgregcal_constructor_body(
if (gcal) {
delete gcal;
}
delete tz;
if (!is_constructor) {
zval_ptr_dtor(return_value);
RETVAL_NULL();
Expand Down
21 changes: 21 additions & 0 deletions ext/intl/tests/gregoriancalendar_adopt_timezone.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
IntlGregorianCalendar timezone-and-locale constructor adopts the TimeZone
--EXTENSIONS--
intl
--INI--
date.timezone=UTC
--FILE--
<?php

$cal = new IntlGregorianCalendar(new DateTimeZone('Europe/Amsterdam'), 'en_US');
echo $cal->getTimeZone()->getID(), "\n";
echo $cal->getType(), "\n";

$cal2 = IntlGregorianCalendar::createInstance('UTC', 'en_US');
echo $cal2->getTimeZone()->getID(), "\n";

@LamentXU123 LamentXU123 Aug 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO The added test does not exercise the fix.

You see, both constructions succeed, while the removed deletion runs only under U_FAILURE(status). The test produces identical expected output on an affected PHP 8.6.0beta1 build.

See here


?>
--EXPECT--
Europe/Amsterdam
gregorian
UTC
Loading