Skip to content

Commit 84f2455

Browse files
committed
Normalize table names consistently in all assignment sites
For consistency, all $this->table_name assignments now go through normalize_column_name(). While ->value is typically already unquoted by the lexer, this makes the code easier to reason about without needing to know that detail.
1 parent ece1e39 commit 84f2455

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

wp-includes/sqlite/class-wp-sqlite-translator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ private function execute_truncate() {
17221722
*/
17231723
private function execute_describe() {
17241724
$this->rewriter->skip();
1725-
$this->table_name = $this->rewriter->consume()->value;
1725+
$this->table_name = $this->normalize_column_name( $this->rewriter->consume()->value );
17261726
$this->set_results_from_fetched_data(
17271727
$this->describe( $this->table_name )
17281728
);
@@ -1840,7 +1840,7 @@ private function execute_update() {
18401840
WP_SQLite_Token::FLAG_KEYWORD_RESERVED
18411841
)
18421842
) {
1843-
$this->table_name = $token->value;
1843+
$this->table_name = $this->normalize_column_name( $token->value );
18441844
}
18451845

18461846
$this->remember_last_reserved_keyword( $token );
@@ -1919,7 +1919,7 @@ private function execute_insert_or_replace() {
19191919
// Consume and record the table name.
19201920
$this->insert_columns = array();
19211921
$this->rewriter->consume(); // INTO.
1922-
$this->table_name = $this->rewriter->consume()->value; // Table name.
1922+
$this->table_name = $this->normalize_column_name( $this->rewriter->consume()->value ); // Table name.
19231923

19241924
/*
19251925
* A list of columns is given if the opening parenthesis
@@ -2198,7 +2198,7 @@ private function peek_table_name( $token ) {
21982198
) {
21992199
return false;
22002200
}
2201-
$table_name = $this->rewriter->peek_nth( 2 )->value;
2201+
$table_name = $this->normalize_column_name( $this->rewriter->peek_nth( 2 )->value );
22022202
if ( 'dual' === strtolower( $table_name ) ) {
22032203
return false;
22042204
}

0 commit comments

Comments
 (0)