[php-src] PHP-8.6: Fix GH-24350: Stale external tz database read after module restart (#24354)
| From: | lazerg via Weilin Du | Date: | Fri, 16 Oct 2026 15:24:58 +0000 |
| Subject: | [php-src] PHP-8.6: Fix GH-24350: Stale external tz database read after module restart (#24354) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142349@lists.php.net to get a copy of this message | ||
Author: lazerg (lazerg)
Committer: Weilin Du (LamentXU123)
Date: 2026-10-16T23:17:06+08:00
Commit: https://github.com/php/php-src/commit/3f5189034fb454f461197ef234f93fb2bd297d21
Raw diff: https://github.com/php/php-src/commit/3f5189034fb454f461197ef234f93fb2bd297d21.diff
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
Changed paths:
M NEWS
M ext/date/php_date.c
Diff:
diff --git a/NEWS b/NEWS
index 156aeb2533f4..1e49099b1718 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 c455b226c34e..ab03c7b63557 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;
}