Index: src/wp-includes/class-wp-site.php
===================================================================
--- src/wp-includes/class-wp-site.php	(revision 40317)
+++ src/wp-includes/class-wp-site.php	(working copy)
@@ -333,17 +333,7 @@
 			$details->home       = get_option( 'home' );
 			restore_current_blog();
 
-			$cache_details = true;
-			foreach ( array( 'blogname', 'siteurl', 'post_count', 'home' ) as $field ) {
-				if ( false === $details->$field ) {
-					$cache_details = false;
-					break;
-				}
-			}
-
-			if ( $cache_details ) {
-				wp_cache_set( $this->blog_id, $details, 'site-details' );
-			}
+			wp_cache_set( $this->blog_id, $details, 'site-details' );
 		}
 
 		/** This filter is documented in wp-includes/ms-blogs.php */
Index: tests/phpunit/tests/multisite/siteDetails.php
===================================================================
--- tests/phpunit/tests/multisite/siteDetails.php	(revision 40317)
+++ tests/phpunit/tests/multisite/siteDetails.php	(working copy)
@@ -125,6 +125,25 @@
 
 		$this->assertNotFalse( $cached_result );
 	}
+
+	/**
+	 * @ticket 40247
+	 */
+	public function test_site_details_cached_including_false_values() {
+		$id = self::factory()->blog->create();
+
+		$site = get_site( $id );
+
+		// Trigger retrieving site details (post_count is not set on new sites)
+		$post_count = $site->post_count;
+
+		$cached_details = wp_cache_get( $site->id, 'site-details' );
+
+		wpmu_delete_blog( $id, true );
+		wp_update_network_site_counts();
+
+		$this->assertNotFalse( $cached_details );
+	}
 }
 
 endif;
