diff --git a/NEWS b/NEWS index 9a98aadadf82..b965048a7be6 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,11 @@ PHP NEWS LXB_API as __declspec(dllimport) when linked statically into PHP. (Luther Monson) +- Opcache: + . 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) + - Phar: . Fixed a bypass of the magic ".phar" directory protection in Phar::addEmptyDir() for paths starting with "/.phar", while allowing diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 6f668af9b714..882c78fd1f2a 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 {