From e80cf1d861e6bb0b43998079692b3da10c4a3a80 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Wed, 16 Aug 2017 21:11:43 +0000 Subject: [PATCH] Canonical: Check first before attempting to include a 'path' value in the URL in `strip_fragment_from_url()`. Props Mte90. Fixes #40542. Built from https://develop.svn.wordpress.org/trunk@41257 git-svn-id: http://core.svn.wordpress.org/trunk@41097 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/canonical.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index dfa6ec515d..12b2445aa1 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -568,7 +568,11 @@ function strip_fragment_from_url( $url ) { if ( ! empty( $parsed_url['port'] ) ) { $url .= ':' . $parsed_url['port']; } - $url .= $parsed_url['path']; + + if ( ! empty( $parsed_url['path'] ) ) { + $url .= $parsed_url['path']; + } + if ( ! empty( $parsed_url['query'] ) ) { $url .= '?' . $parsed_url['query']; } diff --git a/wp-includes/version.php b/wp-includes/version.php index daab568fb4..f47e25e2f5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41256'; +$wp_version = '4.9-alpha-41257'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.