From 343a6587cf1afdf85744a6c75de450905ad07a2c Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Mon, 12 Jan 2015 02:24:22 +0000 Subject: [PATCH] Check for existence of data from `get_blogaddress_by_id()` before returning a URL * Prevent a notice when an invalid ID is used with `get_blogaddres_by_id()`. * Return a falsy empty string rather than the previous "http://". * Add unit tests for `get_blogaddress_by_id()`. Props nerrad. Fixes #30566. Built from https://develop.svn.wordpress.org/trunk@31157 git-svn-id: http://core.svn.wordpress.org/trunk@31138 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-blogs.php | 4 ++-- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index 72ebbaa3a8..d291f169db 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -33,11 +33,11 @@ function wpmu_update_blogs_date() { * @since MU * * @param int $blog_id Blog ID - * @return string + * @return string Full URL of the blog if found. Empty string if not. */ function get_blogaddress_by_id( $blog_id ) { $bloginfo = get_blog_details( (int) $blog_id, false ); // only get bare details! - return esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ); + return isset( $bloginfo->domain ) && isset( $bloginfo->path ) ? esc_url( 'http://' . $bloginfo->domain . $bloginfo->path ) : ''; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 560b68d62a..38ff5807c6 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31156'; +$wp_version = '4.2-alpha-31157'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.