mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Administration: Guard against undefined $GLOBALS['hook_suffix']
in WP_Screen::get()
.
When initially defaulting the screen `$id` in `WP_Screen::get()`, if the `$hook_name` parameter is not supplied, an `else` fallback uses `$GLOBALS['hook_suffix']`. However, in some cases, `hook_suffix` doesn't exist in the global scope. This produces an "Undefined index" notice on < PHP 8, and a warning in >= PHP 8. This change ensures `$GLOBALS['hook_suffix']` has a value before using it as a fallback for the screen ID. Props splendorstudio, SergeyBiryukov, htdat, mukesh27, dd32, costdev. Fixes #49089. Built from https://develop.svn.wordpress.org/trunk@54414 git-svn-id: http://core.svn.wordpress.org/trunk@53973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6441d199f2
commit
8a8bd9192b
@ -212,6 +212,7 @@ final class WP_Screen {
|
||||
return $hook_name;
|
||||
}
|
||||
|
||||
$id = '';
|
||||
$post_type = null;
|
||||
$taxonomy = null;
|
||||
$in_admin = false;
|
||||
@ -220,7 +221,7 @@ final class WP_Screen {
|
||||
|
||||
if ( $hook_name ) {
|
||||
$id = $hook_name;
|
||||
} else {
|
||||
} elseif ( ! empty( $GLOBALS['hook_suffix'] ) ) {
|
||||
$id = $GLOBALS['hook_suffix'];
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-beta3-54413';
|
||||
$wp_version = '6.1-beta3-54414';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user