Skip to content

Commit deb2308

Browse files
committed
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.
1 parent 092fd61 commit deb2308

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ PHP NEWS
1616
Phar::addEmptyDir() for paths starting with "/.phar", while allowing
1717
non-magic directory names that merely share the ".phar" prefix. (Weilin Du)
1818

19+
- Opcache:
20+
. Fixed bug GH-22216 (spurious opcache.memory_consumption warning on each new
21+
ZTS thread; the directive is also reported as 0 in worker threads).
22+
(Daisuke Komazaki)
23+
1924
- Zlib:
2025
. Fixed memory leak if deflate initialization fails and there is a dict.
2126
(ndossche)

ext/opcache/zend_accelerator_module.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ static int validate_api_restriction(void)
7979

8080
static ZEND_INI_MH(OnUpdateMemoryConsumption)
8181
{
82-
if (accel_startup_ok) {
82+
/* On ZTS, each new thread runs the on_modify handlers at STAGE_STARTUP to
83+
* populate its own globals; that is thread init, not a post-startup change. */
84+
if (accel_startup_ok && stage != ZEND_INI_STAGE_STARTUP) {
8385
if (strcmp(sapi_module.name, "fpm-fcgi") == 0) {
8486
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");
8587
} else {

0 commit comments

Comments
 (0)