[php-src] master: Merge branch '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:56+08:00

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

Merge branch 'PHP-8.5'

* PHP-8.5:
  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 6550a7a9641d..3db6bc520e84 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,8 @@ PHP                                                                        NEWS
 - Intl:
   . Fixed grapheme_strrev() treating UBRK_DONE as a byte index and leaving
     the result without a terminating NUL. (iliaal)
+  . Fixed a double-free when IntlGregorianCalendar construction fails after
+    the ICU constructor adopts the TimeZone. (iliaal)
 
 - Phar:
   . Fixed Phar archives being automatically detected when ".phar" only occurs
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index aeb728e29de1..9573bdf5d9e7 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.