10up / 10up-experience

The 10up Experience plugin configures WordPress to better protect and inform clients, aligned to 10up’s best practices.
GNU General Public License v2.0
129 stars 27 forks source link

Add parent menu slug to `add_submenu_page` to avoid PHP 8.2 deprecation notices #135

Closed claytoncollie closed 10 months ago

claytoncollie commented 1 year ago

Description of the Change

This change fixes PHP 8.2 deprecation notices

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /Users/claytoncollie/www/10upexperience/app/public/wp-includes/functions.php on line 7053

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /Users/claytoncollie/www/10upexperience/app/public/wp-includes/functions.php on line 2165

Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/claytoncollie/www/10upexperience/app/public/wp-admin/admin-header.php on line 36

How to test the Change

  1. Create a fresh install of WordPress
  2. Clone repository and checkout branch
  3. Set WP_DEBUG and WP_DEBUG_DISPLAY to true
  4. Visit the wp-admin to look for the errors
  5. Make sure you can visit the about 10up screen --> http://localhost:10003/wp-admin/admin.php?page=10up-about

Changelog Entry

Fixed - Passing null as parameter 1. Define the parent menu slug when registering the submenu screen

Credits

Props @claytoncollie

Checklist:

pabamato commented 11 months ago

I was about to report the same issue. @darylldoyle this passed my tests (PHP 8.2 - WP 6.3.1)