Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions features/plugin-auto-updates-status.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/Plugin_AutoUpdates_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}

Expand Down Expand Up @@ -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 = [];
}

Expand Down Expand Up @@ -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 = [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Plugin_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}

Expand Down
6 changes: 3 additions & 3 deletions src/Theme_AutoUpdates_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}

Expand Down Expand Up @@ -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 = [];
}

Expand Down Expand Up @@ -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 = [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/WP_CLI/ParseThemeNameInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}

Expand Down