[php-src] Issue #22216: "opcache.memory_consumption cannot be changed when OPcache is already set up" warning on 8.5 ZTS

[email protected] (dkkoma) Wed, 3 Jun 2026 04:22:01 +0000
Newsgroups php.bugs
Message-ID <9JJDCDOy7MHK4pv2wix6chUGRWf4QUAqXfOiFzeAANk@main.internal.php.net>
Issue: https://github.com/php/php-src/issues/22216
Author: dkkoma

### Description

In PHP 8.5.6, when running a ZTS application with the following settings in the ini file,
> opcache.memory_consumption cannot be changed when OPcache is already set up.

this warning is printed once for each thread that is started.

```
opcache.enable=1
opcache.memory_consumption=256
opcache.log_verbosity_level=2
```

I reproduced it with FrankenPHP's ZTS/worker mode, but I have confirmed that it reproduces even without FrankenPHP.
Here are the reproduction steps with FrankenPHP.
```
docker run -d --name fp-repro -v /tmp/fp-repro/zz-repro.ini:/usr/local/etc/php/conf.d/zz-repro.ini:ro  dunglas/frankenphp:php8.5
```

It does not affect the actual SHM size, but it also appears that the value referenced by worker threads via `opcache_get_configuration` and similar functions is reported as `0`.

The condition that triggers this warning is currently `if (accel_startup_ok)`, but it looks like the condition `stage != ZEND_INI_STAGE_STARTUP` needs to be added.

### PHP Version

```plain
PHP 8.5.6 (cli) (built: May 19 2026 23:07:51) (ZTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.5.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.6, Copyright (c), by Zend Technologies
```

### Operating System

_No response_