Commit 4eac7a399a0 for php

commit 4eac7a399a0717e96b23b4937008f17e10db0a9e
Author: Daisuke Komazaki <dkkoma@gmail.com>
Date:   Thu Jun 4 16:15:30 2026 +0900

    Fixed GH-22216: don't warn in OnUpdateMemoryConsumption on ZTS thread init

    The ZTS per-thread ini refresh runs on_modify at ZEND_INI_STAGE_STARTUP to
    populate the new thread's globals; skip the accel_startup_ok guard there so
    it is not treated as a post-startup change.

    Closes GH-22225.

diff --git a/NEWS b/NEWS
index 8fcac3a57a5..3548fe39983 100644
--- a/NEWS
+++ b/NEWS
@@ -220,6 +220,9 @@ PHP                                                                        NEWS
   . Fixed bug GH-24988 (Incorrect opcode range check causes bugs with exceptions in
     function JIT). (ndossche, Jorg Sowa)
   . Fix opcache phar check. (ndossche)
+  . Fixed bug GH-22216 (spurious opcache.memory_consumption warning on each new
+    ZTS thread; the directive is also reported as 0 in worker threads).
+    (Daisuke Komazaki)

 - OpenSSL:
   . Fixed build and test compatibility with OpenSSL 4.0 and 4.1.
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index aee877f9a7a..b3afa2d95ef 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -79,7 +79,9 @@ static int validate_api_restriction(void)

 static ZEND_INI_MH(OnUpdateMemoryConsumption)
 {
-	if (accel_startup_ok) {
+	/* On ZTS, each new thread runs the on_modify handlers at STAGE_STARTUP to
+	 * populate its own globals; that is thread init, not a post-startup change. */
+	if (accel_startup_ok && stage != ZEND_INI_STAGE_STARTUP) {
 		if (strcmp(sapi_module.name, "fpm-fcgi") == 0) {
 			zend_accel_error(ACCEL_LOG_WARNING, "opcache.memory_consumption cannot be changed when OPcache is already set up. Are you using php_admin_value[opcache.memory_consumption] in an individual pool's configuration?\n");
 		} else {