From 6d331e9743aaa668985edeeda5830ecda772f307 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 5 Mar 2019 20:37:50 +0000 Subject: [PATCH] Networks and Sites: Check the result of `get_site()` in `wp_insert_site()`. Props davidbinda, vanyukov, lukecarbis. Merges [44799] to the 5.1 branch. Fixes #46300. Built from https://develop.svn.wordpress.org/branches/5.1@44800 git-svn-id: http://core.svn.wordpress.org/branches/5.1@44632 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-site.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/ms-site.php b/wp-includes/ms-site.php index 60d1f29035..ddc71380b3 100644 --- a/wp-includes/ms-site.php +++ b/wp-includes/ms-site.php @@ -69,6 +69,10 @@ function wp_insert_site( array $data ) { $new_site = get_site( $wpdb->insert_id ); + if ( ! $new_site ) { + return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) ); + } + clean_blog_cache( $new_site ); /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 4699cf70d4..de52b2783e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1.1-alpha-44798'; +$wp_version = '5.1.1-alpha-44800'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.