[php-src] PR #24354: Fix GH-24350: Stale external tz database read after module restart
| From: | lazerg | Date: | Thu, 15 Oct 2026 15:19:52 +0000 |
| Subject: | [php-src] PR #24354: Fix GH-24350: Stale external tz database read after module restart | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39471@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24354
Author: lazerg
PHP_MINIT_FUNCTION(date) registered its INI entries before resetting
php_date_global_timezone_db. Registering date.timezone runs
OnUpdate_date_timezone(), which checks the value against DATE_TIMEZONEDB.
On an in-process engine restart (Apache graceful reload, FrankenPHP worker restart), that pointer
still points into the PECL timezonedb .so that the previous shutdown unloaded, so
startup reads unmapped memory and crashes in seek_to_tz_position(). The reset now
happens before REGISTER_INI_ENTRIES().
I checked it with a small embed host on macOS: it loads timezonedb as a shared extension, calls
php_embed_init()/php_embed_shutdown() twice, and maps a
PROT_NONE region over the address range the unloaded .so used. Before the
fix, the second startup crashes in seek_to_tz_position(). After the fix, it starts
normally and still uses the external database. There is no test, because run-tests cannot restart
the engine inside one process.
Fixes GH-24350