WordPress.org

Make WordPress Core

Ticket #41171: 41171-2.patch

File 41171-2.patch, 654 bytes (added by Dency, 4 years ago)

check for empty and isset $self_matches[1] for pagenow

  • wp-includes/vars.php

     
    2828                preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
    2929        else
    3030                preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
    31         $pagenow = $self_matches[1];
     31        $pagenow = ! empty( $self_matches ) && isset( $self_matches[1] ) ? $self_matches[1] : '';
    3232        $pagenow = trim($pagenow, '/');
    3333        $pagenow = preg_replace('#\?.*?$#', '', $pagenow);
    3434        if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {