You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OPcache bypasses the user-defined error handler for deprecations for the first request with a cold cache. This happens regardless of opcache.record-warnings which only has an impact on all following requests. Enabling opcache.record-warnings will yield the expected behavior for every request after the first one which populated the cache.
This does not happen when OPcache is disabled, it will behave properly for every request.
This can be reproduced on a web server whenever opcache_reset() reset is invoked but for simplicity this was also verified to be triggered via CLI (thanks to @TimWolla for this suggestion):
$> php -dopcache.enable_cli=1 --repeat 2 test.php
Executing for the first time...
PHP Deprecated: implicitly_nullable_parameter(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in /opt/homebrew/var/www/test/opcache-deprecations/dependency.php on line 2
Deprecated: implicitly_nullable_parameter(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in /opt/homebrew/var/www/test/opcache-deprecations/dependency.php on line 2
Called
Finished execution, repeating...
Called
$> php --version
PHP 8.4.2 (cli) (built: Dec 17 2024 15:31:31) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.2, Copyright (c) Zend Technologies
with Zend OPcache v8.4.2, Copyright (c), by Zend Technologies
(Note: There is a bonus bug hiding here, the deprecation message is printed twice. However, the first message starts with PHP Deprecated: (…) but the second message only reads Deprecated: (…).)
The script was also invoked manually via CLI without OPcache to verify that the behavior is identical to FPM:
$> php test.php
array(4) {
[0]=>
int(8192)
[1]=>
string(141) "implicitly_nullable_parameter(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead"
*snip*
PHP Version
PHP 8.4.2
Operating System
macOS 15.1.1
The text was updated successfully, but these errors were encountered:
Description
The OPcache bypasses the user-defined error handler for deprecations for the first request with a cold cache. This happens regardless of
opcache.record-warnings
which only has an impact on all following requests. Enablingopcache.record-warnings
will yield the expected behavior for every request after the first one which populated the cache.This does not happen when OPcache is disabled, it will behave properly for every request.
test.php
dependency.php
This can be reproduced on a web server whenever
opcache_reset()
reset is invoked but for simplicity this was also verified to be triggered via CLI (thanks to @TimWolla for this suggestion):(Note: There is a bonus bug hiding here, the deprecation message is printed twice. However, the first message starts with
PHP Deprecated: (…)
but the second message only readsDeprecated: (…)
.)The script was also invoked manually via CLI without OPcache to verify that the behavior is identical to FPM:
PHP Version
PHP 8.4.2
Operating System
macOS 15.1.1
The text was updated successfully, but these errors were encountered: