diff --git a/features/plugin-auto-updates-status.feature b/features/plugin-auto-updates-status.feature index 07539da6..fe765e2e 100644 --- a/features/plugin-auto-updates-status.feature +++ b/features/plugin-auto-updates-status.feature @@ -114,3 +114,10 @@ Feature: Show the status of auto-updates for WordPress plugins hello,disabled duplicate-post,disabled """ + + @require-wp-5.5 + Scenario: Handle malformed option value + When I run `wp option update auto_update_plugins ""` + And I try `wp plugin auto-updates status hello` + Then the return code should be 0 + And STDERR should be empty diff --git a/src/Plugin_AutoUpdates_Command.php b/src/Plugin_AutoUpdates_Command.php index e334c108..3a0b4377 100644 --- a/src/Plugin_AutoUpdates_Command.php +++ b/src/Plugin_AutoUpdates_Command.php @@ -85,7 +85,7 @@ public function enable( $args, $assoc_args ) { $plugins = $this->fetcher->get_many( $args ); $auto_updates = get_site_option( static::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; } @@ -162,7 +162,7 @@ public function disable( $args, $assoc_args ) { $plugins = $this->fetcher->get_many( $args ); $auto_updates = get_site_option( static::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; } @@ -278,7 +278,7 @@ public function status( $args, $assoc_args ) { $plugins = $this->fetcher->get_many( $args ); $auto_updates = get_site_option( static::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; } diff --git a/src/Plugin_Command.php b/src/Plugin_Command.php index 88fbb051..7f3f9f0e 100644 --- a/src/Plugin_Command.php +++ b/src/Plugin_Command.php @@ -751,7 +751,7 @@ protected function get_item_list() { $auto_updates = get_site_option( Plugin_AutoUpdates_Command::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; } diff --git a/src/Theme_AutoUpdates_Command.php b/src/Theme_AutoUpdates_Command.php index 204435bc..f92a67b7 100644 --- a/src/Theme_AutoUpdates_Command.php +++ b/src/Theme_AutoUpdates_Command.php @@ -85,7 +85,7 @@ public function enable( $args, $assoc_args ) { $themes = $this->fetcher->get_many( $args ); $auto_updates = get_site_option( static::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; } @@ -162,7 +162,7 @@ public function disable( $args, $assoc_args ) { $themes = $this->fetcher->get_many( $args ); $auto_updates = get_site_option( static::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; } @@ -278,7 +278,7 @@ public function status( $args, $assoc_args ) { $themes = $this->fetcher->get_many( $args ); $auto_updates = get_site_option( static::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; } diff --git a/src/WP_CLI/ParseThemeNameInput.php b/src/WP_CLI/ParseThemeNameInput.php index fabb2dad..6fb529d4 100644 --- a/src/WP_CLI/ParseThemeNameInput.php +++ b/src/WP_CLI/ParseThemeNameInput.php @@ -76,7 +76,7 @@ private function get_all_themes() { $auto_updates = get_site_option( Theme_AutoUpdates_Command::SITE_OPTION ); - if ( false === $auto_updates ) { + if ( ! is_array( $auto_updates ) ) { $auto_updates = []; }