[wp-trac] [WordPress Trac] #59365: Deprecated notice when calling get_admin_page_title() on some dashboard pages.
WordPress Trac
noreply at wordpress.org
Wed Jul 10 19:49:44 UTC 2024
#59365: Deprecated notice when calling get_admin_page_title() on some dashboard
pages.
----------------------------+--------------------------------
Reporter: apedog | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: minor | Resolution:
Keywords: php81 | Focuses: php-compatibility
----------------------------+--------------------------------
Changes (by hellofromTonya):
* keywords: reporter-feedback php81 => php81
Comment:
Replying to [comment:6 apedog]:
> I couldn't tell if this was indicative of a deeper issue or not.
While this specific issue is not a deeper issue within Core itself, it is
an opportunity to improve the robustness and helpfulness of the code.
I'm thinking about if there's value in adding a defensive guard and a
notice or deprecation message within `get_admin_page_title()` for when
both of the `$title` and `$plugin_page` global variables are not correct
([https://core.trac.wordpress.org/browser/tags/6.5.5/src/wp-
admin/includes/plugin.php#L2051 see the code from 6.5.5]). Maybe something
like this:
{{{
if ( ! is_string( $plugin_page ) ) {
wp_trigger_error(
__FUNCTION__,
'Requires the $plugin_page global variable to be a non-
nullable string data type. '.
'This global variable is automatically set when the admin
URL contains a `page` query parameter.',
E_USER_DEPRECATED
);
$plugin_page = '';
}
$hook = get_plugin_page_hook( $plugin_page, $pagenow );
}}}
This kind of defensive guard moves the detection further into the stack
call, closer to the root of the problem. As in your case @apedog, it's
within the Core function used that triggered the issue.
@apedog would a check have helped you to more quickly identify where the
plugin was doing it wrong?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59365#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list