[php-src] Issue #8883: Incorrect deprecation warning: Passing null to parameter #2 ($client_options) of type ?string is deprecated

From: Date: Tue, 28 Jun 2022 09:12:43 +0000
Subject: [php-src] Issue #8883: Incorrect deprecation warning: Passing null to parameter #2 ($client_options) of type ?string is deprecated
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241824@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8883 Author: rsomla1 ### Description I can reproduce it with the mysql_xdevapi extension (https://github.com/php/pecl-database-mysql_xdevapi) ```php <?php error_reporting(E_ALL); $cli = mysql_xdevapi\getClient('mysqlx://root@localhost',null); ?> ``` Resulted in this output: ``` PHP Deprecated: mysql_xdevapi\getClient(): Passing null to parameter #2 ($client_options) of type ?string is deprecated in /work/test.php on line 4 ``` But I expected this output instead: ``` ``` The second parameter of mysql_xdevapi\getClient is declared as nullable - even in the warning message its type is shown as ?string. Also, from the output of php --re mysql_xdevapi: ``` Function [ <internal:mysql_xdevapi> function mysql_xdevapi\getClient ] { - Parameters [2] { Parameter #0 [ <required> string $uri ] Parameter #1 [ <optional> ?string $client_options = <default> ] } } ``` As I understand it should be OK to pass null as the value of a nullable parameter. Then why the warning? ### PHP Version PHP 8.1.2 ### Operating System Ubuntu 22.04

« previous php.bugs (#241824) next »