[wp-trac] [WordPress Trac] #54700: wp-includes/vars.php can trigger warning

WordPress Trac noreply at wordpress.org
Wed Apr 27 13:46:13 UTC 2022


#54700: wp-includes/vars.php can trigger warning
-----------------------------------+-----------------------------
 Reporter:  janh2                  |       Owner:  SergeyBiryukov
     Type:  defect (bug)           |      Status:  closed
 Priority:  normal                 |   Milestone:  6.0
Component:  Bootstrap/Load         |     Version:  5.8.2
 Severity:  minor                  |  Resolution:  fixed
 Keywords:  php8 has-patch commit  |     Focuses:
-----------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"53294" 53294]:
 {{{
 #!CommitTicketReference repository="" revision="53294"
 Bootstrap/Load: Avoid a PHP warning when setting the `$pagenow` global in
 `wp-includes/vars.php`.

 In some scenarios where `is_admin()` returns true but
 `$_SERVER['PHP_SELF']` does not match a `wp-admin/*` location, setting the
 `$pagenow` global could trigger a PHP warning: `Undefined array key 1`.

 This commit avoids the warning by checking whether the matches array is
 not empty.

 Props janh2, konradyoast, peterwilsoncc.
 Fixes #54700.
 }}}

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


More information about the wp-trac mailing list