mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 12:58:25 +01:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53294 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d47a44ab68
commit
37f91b71c6
@ -29,9 +29,11 @@ if ( is_admin() ) {
|
||||
} else {
|
||||
preg_match( '#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
|
||||
}
|
||||
$pagenow = $self_matches[1];
|
||||
|
||||
$pagenow = ! empty( $self_matches[1] ) ? $self_matches[1] : '';
|
||||
$pagenow = trim( $pagenow, '/' );
|
||||
$pagenow = preg_replace( '#\?.*?$#', '', $pagenow );
|
||||
|
||||
if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
|
||||
$pagenow = 'index.php';
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user