[wp-trac] [WordPress Trac] #57580: Avoid errors from null parameters in add_submenu_page() (was: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in functions.php)

WordPress Trac noreply at wordpress.org
Tue Jan 30 05:35:42 UTC 2024


#57580: Avoid errors from null parameters in add_submenu_page()
-----------------------------+-----------------------------
 Reporter:  ipajen           |       Owner:  (none)
     Type:  defect (bug)     |      Status:  reopened
 Priority:  normal           |   Milestone:  6.5
Component:  General          |     Version:  6.2
 Severity:  normal           |  Resolution:
 Keywords:  PHP81 has-patch  |     Focuses:  administration
-----------------------------+-----------------------------

Comment (by sabernhardt):

 The patch returns `false` early if either the `$parent_slug` or
 `$menu_slug` is empty, before running `plugin_basename()`.

 This is still rather minimal to prevent the PHP 8.1+ errors. It only
 checks two of the five required parameters, and it does not check
 specifically whether the parameters are strings.

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


More information about the wp-trac mailing list