[wp-trac] [WordPress Trac] #49089: hook_suffix is undefined in WP_Screen class

WordPress Trac noreply at wordpress.org
Fri Oct 7 14:24:13 UTC 2022


#49089: hook_suffix is undefined in WP_Screen class
-------------------------------------------------+-------------------------
 Reporter:  splendorstudio                       |       Owner:
                                                 |  davidbaumwald
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1
Component:  Administration                       |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch commit assigned-for-       |     Focuses:
  commit                                         |
-------------------------------------------------+-------------------------
Changes (by davidbaumwald):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54414" 54414]:
 {{{
 #!CommitTicketReference repository="" revision="54414"
 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.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49089#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list