diff --git a/features/plugin.feature b/features/plugin.feature index dfd3f3ef..07dd97db 100644 --- a/features/plugin.feature +++ b/features/plugin.feature @@ -1131,3 +1131,61 @@ Feature: Manage WordPress plugins """ Warning: example: This update requires PHP version 100 """ + + @require-wp-4.0 + Scenario: The unavailable reason of one plugin does not leak into other plugins + Given a WP install + And a wp-content/plugins/aaa-example/aaa-example.php file: + """ + =' ); + // Reset for each plugin so a previous plugin's reason does not leak into this row. + $update_unavailable_reason = ''; + if ( ! $compatible_php ) { $update = 'unavailable'; @@ -1030,7 +1033,7 @@ protected function get_item_list() { 'wporg_status' => $wporg_info['status'], 'wporg_last_updated' => $wporg_info['last_updated'], 'recently_active' => in_array( $file, array_keys( $recently_active ), true ), - 'update_unavailable_reason' => isset( $update_unavailable_reason ) ? $update_unavailable_reason : '', + 'update_unavailable_reason' => $update_unavailable_reason, ]; if ( $this->check_headers['tested_up_to'] ) { diff --git a/src/WP_CLI/ParseThemeNameInput.php b/src/WP_CLI/ParseThemeNameInput.php index df46b9c8..069526af 100644 --- a/src/WP_CLI/ParseThemeNameInput.php +++ b/src/WP_CLI/ParseThemeNameInput.php @@ -103,6 +103,9 @@ private function get_all_themes() { $compatible_php = empty( $requires_php ) || version_compare( PHP_VERSION, $requires_php, '>=' ); $compatible_wp = empty( $requires ) || version_compare( $wp_version, $requires, '>=' ); + // Reset for each theme so a previous theme's reason does not leak into this row. + $update_unavailable_reason = ''; + if ( ! $compatible_php ) { $update = 'unavailable'; @@ -155,7 +158,7 @@ private function get_all_themes() { 'auto_update_indicated' => $auto_update_indicated, 'requires' => $requires, 'requires_php' => $requires_php, - 'update_unavailable_reason' => isset( $update_unavailable_reason ) ? $update_unavailable_reason : '', + 'update_unavailable_reason' => $update_unavailable_reason, 'type' => $theme_type, ];