Commit 38eabd0452d for php

commit 38eabd0452df61e4d871f38e8afe2306490dd3b4
Author: Pavel Gushcha <pavimus@gmail.com>
Date:   Fri Oct 9 17:12:07 2026 +0000

    Fix opcache.interned_strings_buffer being 0 in threads started later (ZTS)

    Since GH-23309 OnUpdateInternedStringsBuffer() rejects any change once
    OPcache is set up, to catch diverging php_admin_value settings of FPM
    pools. Under ZTS every thread started after OPcache's startup re-applies
    the INI entries with ZEND_INI_STAGE_STARTUP into its own, zeroed
    zend_accel_globals; the handler rejects that as well, logs a warning
    for every new thread and leaves ZCG(accel_directives).
    interned_strings_buffer at 0 in that thread (e.g. opcache_get_configuration()
    reports 0 under FrankenPHP and Apache mod_php with threaded MPMs).

    Accept the value at ZEND_INI_STAGE_STARTUP: it is the value the shared
    memory was set up with. Changes at later stages (FPM pools use
    ZEND_INI_STAGE_ACTIVATE) are still rejected.

    Closes GH-24275.

diff --git a/NEWS b/NEWS
index d84ff40a31a..14df7132c7c 100644
--- a/NEWS
+++ b/NEWS
@@ -187,6 +187,8 @@ PHP                                                                        NEWS
     (ndossche, khaledalam)
   . Fix preloaded functions JIT-compiled on load being overwritten
     after restart. (Pavel Gushcha)
+  . Fix opcache.interned_strings_buffer being 0 in threads started later (ZTS).
+    (Pavel Gushcha)

 - OpenSSL:
   . Fixed bug GH-24784 (openssl_pkcs7_read() and openssl_cms_read() overwrite
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 23192e8950b..902d69374bb 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -93,7 +93,12 @@ static ZEND_INI_MH(OnUpdateMemoryConsumption)

 static ZEND_INI_MH(OnUpdateInternedStringsBuffer)
 {
-	if (accel_startup_ok) {
+	/* Under ZTS, every thread started later re-applies the INI entries at
+	 * ZEND_INI_STAGE_STARTUP to fill its own globals. Accepting that is safe: the
+	 * value comes from the global INI directives, so it is the one OPcache was
+	 * set up with. NTS does not have this problem: STARTUP handlers run before
+	 * accel_startup_ok is set, and accel_shutdown() clears it again. */
+	if (accel_startup_ok && stage != ZEND_INI_STAGE_STARTUP) {
 		if (strcmp(sapi_module.name, "fpm-fcgi") == 0) {
 			zend_accel_error(ACCEL_LOG_WARNING, "opcache.interned_strings_buffer cannot be changed when OPcache is already set up. Are you using php_admin_value[opcache.interned_strings_buffer] in an individual pool's configuration?\n");
 		} else {