Skip to content

Commit

Permalink
Merge pull request #61 from stellarwp/bugfix/defend-against-source-as…
Browse files Browse the repository at this point in the history
…-wp-error

Prevent fatal during update prevention when $source is a WP_Error rather than a string
  • Loading branch information
borkweb committed Jan 17, 2024
2 parents 4869a8e + 505123a commit ac61ceb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Uplink/Admin/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,18 @@ public function filter_upgrader_install_package_result( $result, $extras ) {
*
* @since 1.0.0
*
* @param string $source File source location.
* @param mixed $remote_source Remote file source location.
* @param \WP_Upgrader $upgrader WP_Upgrader instance.
* @param array $extras Extra arguments passed to hooked filters.
* @param string|\WP_Error $source File source location or a WP_Error.
* @param mixed $remote_source Remote file source location.
* @param \WP_Upgrader $upgrader WP_Upgrader instance.
* @param array $extras Extra arguments passed to hooked filters.
*
* @return string|\WP_Error
*/
public function filter_upgrader_source_selection_for_update_prevention( $source, $remote_source, $upgrader, $extras ) {
if ( is_wp_error( $source ) ) {
return $source;
}

return $this->container->get( Update_Prevention::class )->filter_upgrader_source_selection( $source, $remote_source, $upgrader, $extras );
}
}

0 comments on commit ac61ceb

Please sign in to comment.