PHP warning thrown visiting non-existent connection pull screen. #1157
Labels
help wanted
needs:engineering
This requires engineering to resolve.
type:bug
Something isn't working.
Milestone
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:
distributor/includes/pull-ui.php
Lines 577 to 581 in c83fde1
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
The text was updated successfully, but these errors were encountered: