From 700c9455ab25493dfc3cc95038f05a2c4ee52ec5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 17 Nov 2020 20:52:09 +0000 Subject: [PATCH] I18N: Avoid PHP notices for relative URLs in `load_script_textdomain()`. Props hellofromTonya, SeBsZ, archon810, nourma, justinahinon, SergeyBiryukov. Fixes #49145. Built from https://develop.svn.wordpress.org/trunk@49639 git-svn-id: http://core.svn.wordpress.org/trunk@49377 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/l10n.php | 6 +++--- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 0c6b75ea24..72a74ff0ac 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -1040,7 +1040,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) { // If the host is the same or it's a relative URL. if ( ( ! isset( $content_url['path'] ) || strpos( $src_url['path'], $content_url['path'] ) === 0 ) && - ( ! isset( $src_url['host'] ) || $src_url['host'] === $content_url['host'] ) + ( ! isset( $src_url['host'] ) || ! isset( $content_url['host'] ) || $src_url['host'] === $content_url['host'] ) ) { // Make the src relative the specific plugin or theme. if ( isset( $content_url['path'] ) ) { @@ -1057,7 +1057,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) { $relative = implode( '/', $relative ); } elseif ( ( ! isset( $plugins_url['path'] ) || strpos( $src_url['path'], $plugins_url['path'] ) === 0 ) && - ( ! isset( $src_url['host'] ) || $src_url['host'] === $plugins_url['host'] ) + ( ! isset( $src_url['host'] ) || ! isset( $plugins_url['host'] ) || $src_url['host'] === $plugins_url['host'] ) ) { // Make the src relative the specific plugin. if ( isset( $plugins_url['path'] ) ) { @@ -1072,7 +1072,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) { $relative = array_slice( $relative, 1 ); // Remove . $relative = implode( '/', $relative ); - } elseif ( ! isset( $src_url['host'] ) || $src_url['host'] === $site_url['host'] ) { + } elseif ( ! isset( $src_url['host'] ) || ! isset( $site_url['host'] ) || $src_url['host'] === $site_url['host'] ) { if ( ! isset( $site_url['path'] ) ) { $relative = trim( $src_url['path'], '/' ); } elseif ( ( strpos( $src_url['path'], trailingslashit( $site_url['path'] ) ) === 0 ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 5e83fe3288..5e255d70e4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-beta4-49638'; +$wp_version = '5.6-beta4-49639'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.