[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5

Weilin Du <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Weilin Du (LamentXU123)
Date: 2026-08-18T02:42:00+08:00

Commit: https://github.com/php/php-src/commit/be4b987cb3f083ef6ca0dae72873cc7eb270ee94
Raw diff: https://github.com/php/php-src/commit/be4b987cb3f083ef6ca0dae72873cc7eb270ee94.diff

Merge branch 'PHP-8.4' into PHP-8.5

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

Changed paths:
  M  NEWS
  M  ext/intl/calendar/gregoriancalendar_methods.cpp


Diff:

diff --git a/NEWS b/NEWS
index baea08f757f5..081461b539ed 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ PHP                                                                        NEWS
   . 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 --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index bf05cd8ad3f0..9910512df1d9 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -165,7 +165,6 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS, bool
 		if (U_FAILURE(status)) {
 			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();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.