Skip to content

[PHP 8.4] Excluding E_DEPRECATED in error_reporting still shows new deprecation messageΒ #16899

@michaljusiega

Description

@michaljusiega

Description

The following code:

<?php

declare(strict_types=1);

error_reporting(E_ALL & ~E_DEPRECATED); // same as error_reporting(E_ALL ^ E_DEPRECATED);

function implicitNullable1(string $foo = null) {}
trigger_error('random message1', E_USER_DEPRECATED);

error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); // same as error_reporting(E_ALL ^ E_DEPRECATED ^ E_USER_DEPRECATED);

function implicitNullable2(string $foo = null) {}
trigger_error('random message2', E_USER_DEPRECATED);

Resulted in this output:

Deprecated: implicitNullable1(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in /in/0lbLD on line 7

Deprecated: implicitNullable2(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in /in/0lbLD on line 12

Deprecated: random message1 in /in/0lbLD on line 8

But I expected this output instead:

Deprecated: random message1 in /in/rrMGQ on line 8

Hi team!

After introducing new deprecation in PHP 8.4 https://wiki.php.net/rfc/deprecate-implicitly-nullable-types i receive similar messages on non-user deprecated functions in my project, but I am unable to silence them by using E_ALL & ~E_DEPRECATED bitmask. I think this is a bug. Or I am wrong. Any solution ?

Thanks!

PHP Version

PHP 8.4.1

Operating System

Ubuntu

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