-
Notifications
You must be signed in to change notification settings - Fork 7.8k
[PHP 8.4] Deprecation notice inconsistencies with opcache enabled #16897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The "implicit nullable" deprecation is a compile time deprecation, which only happens once when Opcache is used, as that is what opcache does. Not sure if this can be fixed @iluuu1994 ? |
Opcache records and replays warnings (see |
@lebris, does it work if you set |
With for i in {0..10}; do curl -k http://localhost/ ; done
<br />
<b>Deprecated</b>: implicitNullable(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in <b>/var/www/html/index.php</b> on line <b>14</b><br />
<br />
<b>Deprecated</b>: Decrement on non-numeric string has no effect and is deprecated in <b>/var/www/html/index.php</b> on line <b>10</b><br />
<br />
<b>Deprecated</b>: implicitNullable(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in <b>/var/www/html/index.php</b> on line <b>14</b><br />
<br />
<b>Deprecated</b>: Decrement on non-numeric string has no effect and is deprecated in <b>/var/www/html/index.php</b> on line <b>10</b><br />
<br />
<b>Deprecated</b>: implicitNullable(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in <b>/var/www/html/index.php</b> on line <b>14</b><br />
[...] Is this behavior (requiring |
To my knowledge, I'm fine with leaving this Off by default, but won't mind enabling it by default. If you want to change the default, please write to the internals mailing list. |
Ah ok, I didn't know this setting was off by default. It makes sense, little reason to throw deprecations that always occur on every request, that just hurts performance. I think this can be closed then.
There's really no point, unless you just want to flood your logs more. |
Just the warning is new, not this option. |
Oops, meant PHP 8.0.0. |
Are you sure that is OPcache, and not some error handler which promotes the deprecation notice to an exception which is not caught? |
@cmb69 When I use |
@vencakrecl, while your issue might be related to this ticket, I suggest to file a new issue – try to provide an SSCCE, though. |
I have same problem when opcache is enabled deprecations are showing in first load request and ignore error reporting settings. (problem started after upgrade from php 8.3 to 8.4.1) |
We are experiencing the same issue in PHP Version 8.4.3. We see the deprecation warnings the first time the page is loaded and then subsequent loads don't show anything. The change to set |
I still can't reproduce this. <?php
function implicitNullable(string $foo = null) {}
First page load shows the deprecation, subsequent do not.
Warning appears on every page load. @chewbackhaus How did you enable the INI? Note that this ini setting is a INI_SYSTEM, meaning you can only enable it through php.ini or httpd.conf (not at runtime). |
I enabled it through the |
Maybe you have a error handler installed? In that case, it would actually be related to #17422. a.php <?php
set_error_handler(function () {});
require __DIR__ . '/b.php'; b.php <?php
function implicitNullable(string $foo = null) {} This produces the behavior described in this issue. However, it's not that the error isn't emitted, but rather that the error handler is called for one but not the other. Could this be what you're observing? |
related to #17422, still waiting for a fix. |
Description
I am observing inconsistent behavior with deprecation notices using php
8.4.1
whenopcache
is enabled.Some deprecation notice disapeared after having been displayed few times.
Code to reproduce :
Here's the output when sending few requests (with apache2 in my case)
Observed Behavior
Expected Behavior
Note : When disabling opcache, both deprecation notices are displayed consistently on every request.
Is this a bug or I am missing something ?
In this example I'm using php
8.4.1
from the official docker imagephp:8.4-apache
and the default php configuration.I made a repo here where you can find everything to reproduce easely : https://github.com./lebris/php8.4-deprecation-opcache
PHP Version
PHP 8.4.1
Operating System
No response
The text was updated successfully, but these errors were encountered: