From f76b77b7c3e0fb48db9fa761842699dfd3e6b6c2 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Tue, 8 Feb 2022 23:41:00 +0000 Subject: [PATCH] Script Loader: Prevent normalizing HTML IDs in `_wp_normalize_relative_css_links()`. This change fixes an issue where `_wp_normalize_relative_css_links()` was not only matching urls, but also HTML IDs. Follow-up to [52036]. Props mahype, costdev, audrasjb, SergeyBiryukov. Fixes #54922. Built from https://develop.svn.wordpress.org/trunk@52695 git-svn-id: http://core.svn.wordpress.org/trunk@52284 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/script-loader.php | 5 +++++ wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index bc52a5f907..d351a502d6 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -2770,6 +2770,11 @@ function _wp_normalize_relative_css_links( $css, $stylesheet_url ) { continue; } + // Skip if the URL is an HTML ID. + if ( str_starts_with( $src_result, '#' ) ) { + continue; + } + // Build the absolute URL. $absolute_url = dirname( $stylesheet_url ) . '/' . $src_result; $absolute_url = str_replace( '/./', '/', $absolute_url ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 69ea982902..0343f7ee17 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52694'; +$wp_version = '6.0-alpha-52695'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.