mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-07 08:01:54 +01:00
Canonical: Check if the URL scheme exists in strip_fragment_from_url()
.
This avoids an "Undefined index" PHP notice when a schemeless URI is passed. Props dd32, SergeyBiryukov. Fixes #55333. Built from https://develop.svn.wordpress.org/trunk@52833 git-svn-id: http://core.svn.wordpress.org/trunk@52422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a793be201b
commit
a1d974a2e1
@ -847,11 +847,17 @@ function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $ur
|
|||||||
* @return string The altered URL.
|
* @return string The altered URL.
|
||||||
*/
|
*/
|
||||||
function strip_fragment_from_url( $url ) {
|
function strip_fragment_from_url( $url ) {
|
||||||
$parsed_url = parse_url( $url );
|
$parsed_url = wp_parse_url( $url );
|
||||||
|
|
||||||
if ( ! empty( $parsed_url['host'] ) ) {
|
if ( ! empty( $parsed_url['host'] ) ) {
|
||||||
// This mirrors code in redirect_canonical(). It does not handle every case.
|
$url = '';
|
||||||
$url = $parsed_url['scheme'] . '://' . $parsed_url['host'];
|
|
||||||
|
if ( ! empty( $parsed_url['scheme'] ) ) {
|
||||||
|
$url = $parsed_url['scheme'] . ':';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url .= '//' . $parsed_url['host'];
|
||||||
|
|
||||||
if ( ! empty( $parsed_url['port'] ) ) {
|
if ( ! empty( $parsed_url['port'] ) ) {
|
||||||
$url .= ':' . $parsed_url['port'];
|
$url .= ':' . $parsed_url['port'];
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-52832';
|
$wp_version = '6.0-alpha-52833';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user