[php-src] master: Fixed GH-22216: don't warn in OnUpdateMemoryConsumption on ZTS thread init

From: Date: Tue, 03 Nov 2026 21:04:02 +0000
Subject: [php-src] master: Fixed GH-22216: don't warn in OnUpdateMemoryConsumption on ZTS thread init
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143294@lists.php.net to get a copy of this message
Author: Daisuke Komazaki (dkkoma) Committer: ndossche (ndossche) Date: 2026-11-03T22:03:04+01:00 Commit: https://github.com/php/php-src/commit/4eac7a399a0717e96b23b4937008f17e10db0a9e Raw diff: https://github.com/php/php-src/commit/4eac7a399a0717e96b23b4937008f17e10db0a9e.diff 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. Changed paths: M NEWS M ext/opcache/zend_accelerator_module.c Diff: diff --git a/NEWS b/NEWS index 8fcac3a57a5e..3548fe399831 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 aee877f9a7af..b3afa2d95ef4 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 {

« previous php.cvs (#143294) next »