Commit 3f5189034fb for php

commit 3f5189034fb454f461197ef234f93fb2bd297d21
Author: lazerg <lazerg2@gmail.com>
Date:   Fri Oct 16 23:17:06 2026 +0800

    Fix GH-24350: Stale external tz database read after module restart (#24354)

    Reset the external timezone database pointer and enabled flag before
    registering the date INI entries. Registering date.timezone invokes its
    update handler, which validates the timezone against DATE_TIMEZONEDB.

    After an in-process engine shutdown, the external database may still point
    into an unloaded timezonedb shared library. Resetting the state first avoids
    reading unmapped memory during the next startup while allowing the external
    database to be installed again when its extension starts.

    Fixes GH-24350.

    Closes #24354

diff --git a/NEWS b/NEWS
index 156aeb2533f..1e49099b171 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,8 @@ PHP                                                                        NEWS
 - Date:
   . Fixed bug GH-20503 (Assertion failure with ext/date DateInterval property
     hash construction). (heathdutton)
+  . Fixed bug GH-24350 (MINIT reads a stale external tz database after an
+    in-process module restart). (Lazizbek Ergashev)

 - DOM:
   . Fixed bug GH-23352 (UAF reading an attribute value node retained across
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index c455b226c34..ab03c7b6355 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -446,12 +446,13 @@ ZEND_MODULE_POST_ZEND_DEACTIVATE_D(date)
 /* {{{ PHP_MINIT_FUNCTION */
 PHP_MINIT_FUNCTION(date)
 {
+	php_date_global_timezone_db = NULL;
+	php_date_global_timezone_db_enabled = 0;
+
 	REGISTER_INI_ENTRIES();
 	date_register_classes();
 	register_php_date_symbols(module_number);

-	php_date_global_timezone_db = NULL;
-	php_date_global_timezone_db_enabled = 0;
 	DATEG(last_errors) = NULL;
 	return SUCCESS;
 }