WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#14064 closed defect (bug)

In certain situations (migrations, etc.) the admin login page style urls are incorrect — at Version 1

Reported by: mongoose643 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9.2
Component: Administration Keywords: reporter-feedback
Focuses: Cc:

Description (last modified by nacin)

I found this bug after launching a wordpress site that was initially set up in a subdirectory on a different domain and then moved to the web root of the primary domain. I don't know for sure that this procedure is what brought out the bug.

On a more technical note, the bug is that the WP_Styles::_css_href() method has an if statement condition that checks the SRC URI for the stylesheet. Unlike other places in the system, this conditional check did not account for root relative URIs by checking to see if the first character was a forward slash "/".

Here is the modified version of this method:

function _css_href( $src, $ver, $handle ) {
    if ( !preg_match('|^https?://|', $src) && substr($src, 0, 1) != '/' && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
        $src = $this->base_url . $src;
    }

    $src = add_query_arg('ver', $ver, $src);
    $src = apply_filters( 'style_loader_src', $src, $handle );
    return esc_url( $src );
}

Change History (1)

comment:1 nacin4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.