Commit be4b987cb3f for php.net

commit be4b987cb3f083ef6ca0dae72873cc7eb270ee94
Merge: acce3c75144 850aa02c143
Author: Weilin Du <weilindu@php.net>
Date:   Tue Aug 18 02:42:00 2026 +0800

    Merge branch 'PHP-8.4' into PHP-8.5

    * PHP-8.4:
      Fix IntlGregorianCalendar double-free of an adopted TimeZone (#23321)

diff --cc NEWS
index baea08f757f,8f462c66a26..081461b539e
--- a/NEWS
+++ b/NEWS
@@@ -9,9 -9,11 +9,13 @@@ PH
  - DOM:
    . Fixed a use-after-free when cloning a DOMNameSpaceNode after
      DOMDocument::xinclude(). (iliaal)
 +  . Fixed a crash in DOMXPath when a php:function callback receives a nodeset
 +    and a later callback returns a node from another document. (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)

diff --cc ext/intl/calendar/gregoriancalendar_methods.cpp
index bf05cd8ad3f,0725cb4582f..9910512df1d
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@@ -159,13 -159,15 +159,12 @@@ static void _php_intlgregcal_constructo
  			locale = const_cast<char*>(intl_locale_get_default());
  		}

 -		gcal = new GregorianCalendar(tz, Locale::createFromName(locale),
 -			status);
 +		gcal = std::unique_ptr<GregorianCalendar>(new GregorianCalendar(tz, Locale::createFromName(locale),
 +			status));
  			// Should this throw?
  		if (U_FAILURE(status)) {
 -			intl_error_set(NULL, status, "intlgregcal_create_instance: error "
 -				"creating ICU GregorianCalendar from time zone and locale", 0);
 -			if (gcal) {
 -				delete gcal;
 -			}
 +			intl_error_set(NULL, status, "error creating ICU "
 +				"GregorianCalendar from time zone and locale");
- 			delete tz;
  			if (!is_constructor) {
  				zval_ptr_dtor(return_value);
  				RETVAL_NULL();