Skip to content

[PHP 8.4] Deprecation notice inconsistencies with opcache enabled #16897

@lebris

Description

@lebris

Description

I am observing inconsistent behavior with deprecation notices using php 8.4.1 when opcache is enabled.
Some deprecation notice disapeared after having been displayed few times.

Code to reproduce :

<?php

declare(strict_types=1);

error_reporting(E_ALL);
ini_set('display_errors', true);

// php 8.3 deprecation : triggered every time
$a = 'blabla';
$a--;

// php 8.4 deprecation : triggered once
function implicitNullable(string $foo = null) {}

Here's the output when sending few requests (with apache2 in my case)

for i in {0..5}; do curl 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>:  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>:  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>:  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>:  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>:  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 />

Observed Behavior

  • The "implicit nullable" deprecation appears only once (or twice in my app) and stops appearing.
  • The "decrement on non-numeric string" deprecation appears on every request as expected.

Expected Behavior

  • Both deprecation notices should appear consistently on every request.

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 image php: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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions