From 898c3212eff4f7aba92991b49809b3433701d917 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 25 Nov 2026 11:56:02 +0000 Subject: [PATCH] Report an error when the autoload value cannot be stored set_autoload() ignored the result of $wpdb->update(), so a failed query still printed success. It is now also reached from `wp option update` when only the autoload value changes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx --- features/option.feature | 39 +++++++++++++++++++++++++++++++++++++++ src/Option_Command.php | 6 +++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/features/option.feature b/features/option.feature index 61b041630..bd6c05591 100644 --- a/features/option.feature +++ b/features/option.feature @@ -286,6 +286,45 @@ Feature: Manage WordPress options on """ + Scenario: Report an error when the autoload value cannot be stored + Given a WP install + And a wp-content/mu-plugins/fail-autoload-update.php file: + """ + update( + $updated = $wpdb->update( $wpdb->options, array( 'autoload' => $autoload ), array( 'option_name' => $option ) ); + if ( false === $updated ) { + WP_CLI::error( "Could not update autoload value for '{$option}' option." ); + } + // Recreate cache refreshing from update_option(). $notoptions = wp_cache_get( 'notoptions', 'options' );