As the $connection object isn't an object, the site->blog_id property throws a notice.
The issue can be resolved by validating that the connection is an internal connection before accessing the property. If it's neither an internal or external connection then the function can return early.
Steps to Reproduce
Visit the admin page for an external connection that does not exist /wp-admin/admin.php?page=pull&connection_type=external&connection_id=1 (this presumes Post 1 is not an external connection.
Describe the bug
A PHP warning (notice in PHP 7.x and earlier) can be thrown visiting the pull content screen for an external connection that does not exist.
The error is caused by this block of code assuming than if a connection screen is internal if no valid external connection is found:
https://github.com/10up/distributor/blob/c83fde14ce73b81556adf6cd4f77ce0c63737fd1/includes/pull-ui.php#L577-L581
As the
$connection
object isn't an object, thesite->blog_id
property throws a notice.The issue can be resolved by validating that the connection is an internal connection before accessing the property. If it's neither an internal or external connection then the function can return early.
Steps to Reproduce
/wp-admin/admin.php?page=pull&connection_type=external&connection_id=1
(this presumes Post 1 is not an external connection.Screenshots, screen recording, code snippet
Log
Environment information
WordPress information
WordPress 6.4.1 Distributor: Develop
Code of Conduct