[wp-trac] [WordPress Trac] #60073: WordPress core function causing persistent deprecated warning when WP_DEBUG enabled

WordPress Trac noreply at wordpress.org
Fri Dec 15 01:06:45 UTC 2023


#60073: WordPress core function causing persistent deprecated warning when WP_DEBUG
enabled
--------------------------+------------------------
 Reporter:  earthman100   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Database      |     Version:  6.4.2
 Severity:  normal        |  Resolution:  duplicate
 Keywords:                |     Focuses:
--------------------------+------------------------
Changes (by SergeyBiryukov):

 * status:  new => closed
 * resolution:   => duplicate
 * milestone:  Awaiting Review =>


Old description:

> Upgrading to PHP 8.1 surfaces this
>
> {{{
> Deprecated: mysqli_real_connect(): Passing null to parameter #5
> ($database) of type ?string is deprecated in /code/wp-includes/class-
> wpdb.php on line 1987 Deprecated: mysqli_real_connect(): Passing null to
> parameter #7 ($socket) of type ?string is deprecated in /code/wp-includes
> /class-wpdb.php on line 1987
> }}}
>

> From what I can see, Parameter # 5 and # 7 are both explicitly set as
> null directly in the core file - see attached:
>
> [[Image(https://lh3.googleusercontent.com/u/0/drive-
> viewer/AEYmBYRKKP24W5t79A5UlR9Fdju0R8Kvs0__nZW1WeH8D0w9f7aRpDH6DnU2m3M3qaEc_Fn_gY5lvA54RGw5OcMDR2-2Mjtp9Q=w1536-h2048)]]

New description:

 Upgrading to PHP 8.1 surfaces this

 {{{
 Deprecated: mysqli_real_connect(): Passing null to parameter #5
 ($database) of type ?string is deprecated in /code/wp-includes/class-
 wpdb.php on line 1987
 Deprecated: mysqli_real_connect(): Passing null to parameter #7 ($socket)
 of type ?string is deprecated in /code/wp-includes/class-wpdb.php on line
 1987
 }}}


 From what I can see, Parameter # 5 and # 7 are both explicitly set as null
 directly in the core file - see attached:

 [[Image(https://lh3.googleusercontent.com/u/0/drive-
 viewer/AEYmBYRKKP24W5t79A5UlR9Fdju0R8Kvs0__nZW1WeH8D0w9f7aRpDH6DnU2m3M3qaEc_Fn_gY5lvA54RGw5OcMDR2-2Mjtp9Q=w1536-h2048)]]

--

Comment:

 Hi there, thanks for the ticket!

 This was previously raised in #56836 and #54877:
 * The `$database`, `$port`, and `$socket` parameters of
 `mysqli_real_connect()` should actually be nullable, as they are `null` by
 default in [https://github.com/php/php-
 src/blob/c68591fa1681dd63b34a429a3378c37f4a657d8d/ext/mysqli/mysqli.stub.php#L294-L306
 PHP source], per comment:15:ticket:54877. According to the
 [https://www.php.net/manual/en/mysqli.real-connect.php PHP manual], these
 parameters can all accept `null`.
 * The issue is caused by
 [https://www.php.net/manual/en/install.unix.litespeed.php LiteSpeed PHP],
 per comment:3:ticket:56836.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60073#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list