From a22411512647b3ced98315fe91bc289161d2e569 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 09:45:45 +0000 Subject: [PATCH 1/2] Initial plan From cdb494e78370f411de47d7d0e633e0f493cd1bdd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 09:49:14 +0000 Subject: [PATCH 2/2] Remove unnecessary SQL mode check from wp db query command This check was causing authentication failures when custom connection parameters (like --host) were passed, because get_current_sql_modes() ignored those parameters. The check is also unnecessary since wp db query doesn't use WPDB directly, and was inconsistently applied (skipped for STDIN). Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/db-query.feature | 27 --------------------------- src/DB_Command.php | 5 ----- 2 files changed, 32 deletions(-) diff --git a/features/db-query.feature b/features/db-query.feature index 5831a536..76ac806c 100644 --- a/features/db-query.feature +++ b/features/db-query.feature @@ -84,31 +84,4 @@ Feature: Query the database with WordPress' MySQL config When I try `wp db query --no-defaults --debug` Then STDERR should match #Debug \(db\): Running shell command: /usr/bin/env (mysql|mariadb) --no-defaults --no-auto-rehash# - Scenario: SQL modes do not include any of the modes incompatible with WordPress - Given a WP install - When I try `wp db query 'SELECT @@SESSION.sql_mode;' --debug` - Then STDOUT should not contain: - """ - NO_ZERO_DATE - """ - And STDOUT should not contain: - """ - ONLY_FULL_GROUP_BY - """ - And STDOUT should not contain: - """ - STRICT_TRANS_TABLES - """ - And STDOUT should not contain: - """ - STRICT_ALL_TABLES - """ - And STDOUT should not contain: - """ - TRADITIONAL - """ - And STDOUT should not contain: - """ - ANSI - """ diff --git a/src/DB_Command.php b/src/DB_Command.php index 7409935c..6f1d1762 100644 --- a/src/DB_Command.php +++ b/src/DB_Command.php @@ -533,11 +533,6 @@ public function query( $args, $assoc_args ) { $assoc_args['execute'] = $args[0]; } - if ( isset( $assoc_args['execute'] ) ) { - // Ensure that the SQL mode is compatible with WPDB. - $assoc_args['execute'] = $this->get_sql_mode_query( $assoc_args ) . $assoc_args['execute']; - } - $is_row_modifying_query = isset( $assoc_args['execute'] ) && preg_match( '/\b(UPDATE|DELETE|INSERT|REPLACE|LOAD DATA)\b/i', $assoc_args['execute'] ); if ( $is_row_modifying_query ) {