[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 15:09:10 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:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:  PHP82
  Focuses:                |
--------------------------+-----------------------------
 == 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."

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


More information about the wp-trac mailing list