[wp-trac] [WordPress Trac] #57974: PHP 8.2 Warning preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated nav-menus.php

WordPress Trac noreply at wordpress.org
Thu Mar 23 16:02:54 UTC 2023


#57974: PHP 8.2 Warning         preg_replace(): Passing null to parameter #3
($subject) of type array|string is deprecated nav-menus.php
--------------------------+------------------------
 Reporter:  ipajen        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Menus         |     Version:
 Severity:  normal        |  Resolution:  duplicate
 Keywords:  php81         |     Focuses:
--------------------------+------------------------
Changes (by costdev):

 * status:  new => closed
 * component:  General => Menus
 * milestone:  Awaiting Review =>
 * keywords:  PHP82 => php81
 * resolution:   => duplicate


Old description:

> == Bug Report
> === Description
> When using a theme that use /wp-admin/nav-menus.php following PHP warning
> is given:
>

> {{{
>

> preg_replace(): Passing null to parameter #3 ($subject) of type
> array|string is deprecated
>

> wp-admin/includes/plugin.php:2088
> preg_replace()
> wp-admin/includes/plugin.php:2088
> get_plugin_page_hookname()
> wp-admin/includes/plugin.php:2052
> get_plugin_page_hook()
> wp-admin/includes/plugin.php:1976
> get_admin_page_title()
> wp-admin/admin-header.php:35
> }}}
>
> === Environment
> - WordPress: 6.2-RC3
> - PHP: 8.2.0
> - Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.2.0
> - Database: mysqli (Server: 10.4.27-MariaDB / Client: mysqlnd 8.2.0)
> - Browser: Edge 111.0.1661.44 (Windows 10/11)
> - Theme: GeneratePress 3.3.0
> - MU-Plugins:
>   * WordPress automation by Installatron
> - Plugins:
>   * Git Updater 12.1.3
>   * Plugin Compatibility Checker 1.9
>   * Plugin Dependencies 1.7.8
>   * Query Monitor 3.12.0
>   * Restaurant Menu 2.4.2
>   * WordPress Beta Tester 3.3.5
>
> === Steps to Reproduce
> 1. Enable DEBUG
> 2. Use a theme that use /wp-admin/nav-menus.php and go there.
> x. 🐞 Bug occurs.
>
> === Expected Results
> 1.  ✅ No PHP warning.
>
> === Actual Results
> 1.  ❌ PHP warning is shown.
>
> Note:
> Ticket at Generatepress theme:
> https://generatepress.com/forums/topic/php-8-1-deprecated-warning-
> preg_replace/
>
> Tried "Twenty Twenty-Three Version: 1.1" but it gives "with Your theme
> does not support navigation menus or widgets."

New description:

 == Bug Report
 === Description
 When using a theme that use /wp-admin/nav-menus.php following PHP warning
 is given:


 {{{


 preg_replace(): Passing null to parameter #3 ($subject) of type
 array|string is deprecated


 wp-admin/includes/plugin.php:2088
 preg_replace()
 wp-admin/includes/plugin.php:2088
 get_plugin_page_hookname()
 wp-admin/includes/plugin.php:2052
 get_plugin_page_hook()
 wp-admin/includes/plugin.php:1976
 get_admin_page_title()
 wp-admin/admin-header.php:35
 }}}

 === Environment
 - WordPress: 6.2-RC3
 - PHP: 8.2.0
 - Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1p PHP/8.2.0
 - Database: mysqli (Server: 10.4.27-MariaDB / Client: mysqlnd 8.2.0)
 - Browser: Edge 111.0.1661.44 (Windows 10/11)
 - Theme: GeneratePress 3.3.0
 - MU-Plugins:
   * WordPress automation by Installatron
 - Plugins:
   * Git Updater 12.1.3
   * Plugin Compatibility Checker 1.9
   * Plugin Dependencies 1.7.8
   * Query Monitor 3.12.0
   * Restaurant Menu 2.4.2
   * WordPress Beta Tester 3.3.5

 === Steps to Reproduce
 1. Enable DEBUG
 2. Use a theme that use /wp-admin/nav-menus.php and go there.
 x.  Bug occurs.

 === Expected Results
 1.   No PHP warning.

 === Actual Results
 1.   PHP warning is shown.

 Note:
 Ticket at Generatepress theme:
 https://generatepress.com/forums/topic/php-8-1-deprecated-warning-
 preg_replace/

 Tried "Twenty Twenty-Three Version: 1.1" but it gives "with Your theme
 does not support navigation menus or widgets."

--

Comment:

 Hi @ipajen, thanks for opening this ticket.

 This has been fixed as part in #57918 and has been milestoned for 6.2.1.

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


More information about the wp-trac mailing list