• Kyle

    (@kylewlawrence)


    Hi,

    There is an error in the PHP for the Class to hide the backend. Here is the error:
    Undefined index: path in /public_html/wp-content/plugins/better-wp-security/core/modules/hide-backend/class-itsec-hide-backend.php on line 185

    This doesn’t always occur, but clearly sometimes the $_SERVER[‘REQUEST_URI’] value does not always return a ‘path’ in the array when parse_url is used. Could this be fixed to keep the log file clean so that we can be secure by monitoring our logs?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @kylewlawrence

    … but clearly sometimes the $_SERVER[‘REQUEST_URI’] value does not always return a ‘path’ in the array when parse_url is used.

    Hmm, the code should check whether the path array key exists before using it …

    Is there any chance you can find out whether this is happening because:

    a. the $_SERVER[‘REQUEST_URI’] url does not contain a path,
    b. the parse_url() command is failing to return an array with the path key
    c. the parse_url() command returns false due a malformed url ?

    What web server, server platform and php versions are you using ?

    @kylewlawrence

    Anyway changing line 181 and 185 in the better-wp-security/core/modules/hide-backend/class-itsec-hide-backend.php file:

    $url_info = parse_url( $_SERVER['REQUEST_URI'] );
    ...
    if ( $url_info['path'] === $login_path || $url_info['path'] === $login_path_trailing_slash ) {

    into:

    $url_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
    ...
    if ( $url_path === $login_path || $url_path === $login_path_trailing_slash ) {

    will prevent the error from reoccurring.

    • This reply was modified 7 years, 11 months ago by pronl. Reason: Code edit for improved readability
    Thread Starter Kyle

    (@kylewlawrence)

    Thanks @pronl. Is there some iThemes Security staff that will update this in the next release?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error in Hide Backend Function’ is closed to new replies.