Commit 4e64a2655e9 for php.net
commit 4e64a2655e9444afaf12970c41d45fbbc9abb2c7
Author: tianfenghan <rango@swoole.com>
Date: Fri Jul 3 11:50:34 2026 +0800
Fix GH-22567 (Windows ZTS CLI SAPI should refresh its TSRMLS cache during request activation)
Closes GH-22568
diff --git a/NEWS b/NEWS
index 46824ac7d6a..0382330fa8c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.4.27
+- CLI
+ . Fix GH-22567 (Windows ZTS CLI SAPI should refresh its TSRMLS cache during
+ request activation). (matyhtf)
+
- DOM:
. Fixed use-after-free when re-constructing a DOMXPath whose php:function
registrations are freed while still reachable from the cycle collector.
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 4b19cf0604c..6894f57c12c 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -356,6 +356,15 @@ static void sapi_cli_log_message(const char *message, int syslog_type_int) /* {{
}
/* }}} */
+static int sapi_cli_activate(void) /* {{{ */
+{
+#if defined(PHP_WIN32) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE();
+#endif
+ return SUCCESS;
+}
+/* }}} */
+
static int sapi_cli_deactivate(void) /* {{{ */
{
fflush(stdout);
@@ -420,7 +429,7 @@ static sapi_module_struct cli_sapi_module = {
php_cli_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
- NULL, /* activate */
+ sapi_cli_activate, /* activate */
sapi_cli_deactivate, /* deactivate */
sapi_cli_ub_write, /* unbuffered write */