[wp-trac] [WordPress Trac] #57578: Deprecated preg_replace() warning PHP 8.1
WordPress Trac
noreply at wordpress.org
Sun Jan 29 15:10:30 UTC 2023
#57578: Deprecated preg_replace() warning PHP 8.1
-----------------------------+---------------------
Reporter: ipajen | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.2
Component: Administration | Version: trunk
Severity: normal | Resolution:
Keywords: php81 has-patch | Focuses:
-----------------------------+---------------------
Changes (by SergeyBiryukov):
* keywords: php81 => php81 has-patch
* component: General => Administration
* milestone: Awaiting Review => 6.2
Comment:
Hi there, thanks for the ticket!
After some testing, it appears that the notice is only triggered on these
privacy screens and not on others because these screens don't set the
`$title` global that exists on other screens. This causes
`get_admin_page_title()`, instead of returning early like on other
screens, to continue with retrieving the page title from the menu array.
In the process, `get_plugin_page_hook()` is called, but as these screens
are created by core and not by a plugin, the `$plugin_page` global is not
set, and `get_plugin_page_hookname()` receives `null` as the first
parameter instead of a string.
[attachment:"57578.diff"] fixes the inconsistency by setting the `$title`
global on the affected screens, since it is apparently assumed to be set
on all core administration screens. This resolves the notice in my
testing. No new strings are introduced, because these strings match the
existing page titles.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57578#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list