Skip to content

Commit 2cf82b0

Browse files
swissspidyclaude
andcommitted
Read the primary key prefixes as arrays
SHOW INDEX names its columns in mixed case, which the coding standards reject as object properties. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx
1 parent 6333cb6 commit 2cf82b0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/Search_Replace_Command.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,9 +1875,9 @@ private function create_where_key_tables( $table, $primary_keys, $columns ) {
18751875
// prefixes as the table's own, as a TEXT or BLOB column can only be indexed by a prefix.
18761876
$key_prefixes = array();
18771877
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- escaped through self::esc_sql_ident
1878-
foreach ( (array) $wpdb->get_results( "SHOW INDEX FROM $table_sql WHERE Key_name = 'PRIMARY'" ) as $index_col ) {
1879-
if ( isset( $index_col->Column_name, $index_col->Sub_part ) && (int) $index_col->Sub_part > 0 ) {
1880-
$key_prefixes[ $index_col->Column_name ] = (int) $index_col->Sub_part;
1878+
foreach ( (array) $wpdb->get_results( "SHOW INDEX FROM $table_sql WHERE Key_name = 'PRIMARY'", ARRAY_A ) as $index_col ) {
1879+
if ( isset( $index_col['Column_name'], $index_col['Sub_part'] ) && (int) $index_col['Sub_part'] > 0 ) {
1880+
$key_prefixes[ $index_col['Column_name'] ] = (int) $index_col['Sub_part'];
18811881
}
18821882
}
18831883
$key_index_sql = implode(

0 commit comments

Comments
 (0)