diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/vars.php --- a/wp/wp-includes/vars.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/vars.php Tue Sep 27 16:37:53 2022 +0200 @@ -2,8 +2,8 @@ /** * Creates common globals for the rest of WordPress * - * Sets $pagenow global which is the current page. Checks - * for the browser to set which one is currently being used. + * Sets $pagenow global which is the filename of the current screen. + * Checks for the browser to set which one is currently being used. * * Detects which user environment WordPress is being used on. * Only attempts to check for Apache, Nginx and IIS -- three web @@ -29,9 +29,11 @@ } 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 { @@ -65,7 +67,7 @@ if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) { if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Lynx' ) !== false ) { $is_lynx = true; - } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Edge' ) !== false ) { + } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Edg' ) !== false ) { $is_edge = true; } elseif ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chrome' ) !== false ) { if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {