Make WordPress Core

Ticket #51773: patch.diff

File patch.diff, 919 bytes (added by bjorsch, 6 years ago)

Patch to check for empty $script_filename_dir before passing it to strpos()

  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index 58a098f916..cbd17d211d 100644
    function wp_guess_url() { 
    55135513                                $directory = str_replace( ABSPATH, '', $script_filename_dir );
    55145514                                // Strip off the subdirectory, and any file/query params.
    55155515                                $path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '', $_SERVER['REQUEST_URI'] );
    5516                         } elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
     5516                        } elseif ( '' !== $script_filename_dir && false !== strpos( $abspath_fix, $script_filename_dir ) ) {
    55175517                                // Request is hitting a file above ABSPATH.
    55185518                                $subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
    55195519                                // Strip off any file/query params from the path, appending the subdirectory to the installation.