add_submenu_page call causing Deprecation warnings in PHP 8.1
-
oauth2-provider/includes/admin-options.php
makes two calls toadd_submenu_page
with a null first parameter, starting on line 52. This causes a null path to be sent to various built in string functions which no longer accept null arguments (viawp_normalize_path
inwp-includes/functions.php
).In PHP 8.1 this causes deprecation warnings whenever the WordPress dashboard is visited, and presumably this will cause errors in future versions of PHP. Eg.:
PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
WordPress developers have said the functions are designed only to take strings and they won’t protect against null values (https://core.trac.www.ads-software.com/ticket/58772).
Replacing the null parameters with empty strings appears to solve the problem, but I don’t know whether this may have other unexpected consequences.
- The topic ‘add_submenu_page call causing Deprecation warnings in PHP 8.1’ is closed to new replies.