id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 46300 Return type/value of get_site is not being checked in wp_insert_site david.binda SergeyBiryukov "The `get_site` function may return `null` in case the site is not found ( see https://core.trac.wordpress.org/browser/trunk/src/wp-includes/ms-site.php?rev=44727#L293 ), otherwise returns a `WP_Site` object. The function is being called from inside the `wp_insert_site` (see https://core.trac.wordpress.org/browser/trunk/src/wp-includes/ms-site.php?rev=44727#L70 ) and the `WP_Site` object is implicitly expected, as the follow-up code treats the `$new_site` variable as an object (eg.: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/ms-site.php?rev=44727#L114). I haven't run into any issues, but it might be worth checking the return type and return `WP_Error` out of the `wp_insert_site` instead of `0` in case the call to `get_site` fails. (the `0` would be an result of `null->id`, producing `null` casted to `int`)." enhancement closed normal 5.1.1 Networks and Sites 5.1 normal fixed has-patch commit multisite