Skip to content

Commit 124e48d

Browse files
committed
Respect SQL modes in the query corpus
MySQL reads a query according to the SQL modes of its session, and test files select these modes, but the corpus test read every query in the default modes. So 20 queries failed that MySQL accepts in their modes, and 31 that passed got different tokens than in MySQL. The extractor now follows SET statements and connections to find the modes that affect the lexer, and stores them in a second CSV column. A query that runs in several sets of modes has a row for each, which adds 243 rows. The corpus test and the benchmark pass the modes to the lexer. Every row now gets the same result on MySQL 8.4.10 in its modes, except for 26 SHOW PARSE_TREE queries that only debug builds of MySQL accept.
1 parent 6a67e82 commit 124e48d

8 files changed

Lines changed: 1147 additions & 431 deletions

File tree

‎packages/mysql-parser/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ This requires `bash`, `git`, and `php`. It performs the following steps:
9393
2. Extract SQL queries from the MySQL test files.
9494
3. Store the queries under `data/mysql-server-query-corpus/mysql-latest.csv`.
9595

96+
A query that runs in SQL modes that affect the lexer has them in a second column.
97+
9698
## Tests and benchmarks
9799
To run lexer and parser tests and benchmarks, use:
98100

‎packages/mysql-parser/data/mysql-server-query-corpus/mysql-latest.csv‎

Lines changed: 642 additions & 352 deletions
Large diffs are not rendered by default.
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
5+
require_once __DIR__ . '/../tools/class-query-corpus-sql-modes.php';
6+
7+
/**
8+
* Tests for following the SQL modes of the sessions in MySQL server test files.
9+
*/
10+
class WP_MySQL_Query_Corpus_SQL_Modes_Tests extends TestCase {
11+
/**
12+
* @dataProvider data_queries
13+
*/
14+
public function test_queries_change_the_modes( array $queries, string $expected ): void {
15+
$sql_modes = new Query_Corpus_SQL_Modes();
16+
foreach ( $queries as $query ) {
17+
$sql_modes->run_query( $query );
18+
}
19+
$this->assertSame( $expected, $sql_modes->get_modes() );
20+
}
21+
22+
public function data_queries(): array {
23+
return array(
24+
// The value can be a string or a word, and the modes are sorted.
25+
'no query' => array( array(), '' ),
26+
'single-quoted string' => array( array( "SET sql_mode = 'ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
27+
'double-quoted string' => array( array( 'SET sql_mode = "ANSI_QUOTES"' ), 'ANSI_QUOTES' ),
28+
'word' => array( array( 'set sql_mode=pipes_as_concat' ), 'PIPES_AS_CONCAT' ),
29+
'several modes' => array( array( "SET sql_mode = 'PIPES_AS_CONCAT,ANSI_QUOTES'" ), 'ANSI_QUOTES,PIPES_AS_CONCAT' ),
30+
'spaces in a string' => array( array( "SET sql_mode = 'PIPES_AS_CONCAT, ANSI_QUOTES'" ), 'ANSI_QUOTES,PIPES_AS_CONCAT' ),
31+
'every lexer mode' => array(
32+
array( "SET sql_mode = 'PIPES_AS_CONCAT,NO_BACKSLASH_ESCAPES,IGNORE_SPACE,HIGH_NOT_PRECEDENCE,ANSI_QUOTES'" ),
33+
'ANSI_QUOTES,HIGH_NOT_PRECEDENCE,IGNORE_SPACE,NO_BACKSLASH_ESCAPES,PIPES_AS_CONCAT',
34+
),
35+
'modes that the lexer ignores' => array( array( "SET sql_mode = 'TRADITIONAL,ANSI_QUOTES,NO_ZERO_DATE'" ), 'ANSI_QUOTES' ),
36+
'the ANSI mode' => array( array( "set sql_mode='ansi'" ), 'ANSI_QUOTES,IGNORE_SPACE,PIPES_AS_CONCAT' ),
37+
'a word for the ANSI mode' => array( array( 'set sql_mode=ansi' ), 'ANSI_QUOTES,IGNORE_SPACE,PIPES_AS_CONCAT' ),
38+
39+
// The session variable has several spellings.
40+
'SESSION' => array( array( "SET SESSION sql_mode='ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
41+
'LOCAL' => array( array( "SET LOCAL sql_mode='ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
42+
'@@' => array( array( "SET @@sql_mode='ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
43+
'@@session.' => array( array( "SET @@session.sql_mode='ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
44+
'@@local.' => array( array( "SET @@local.sql_mode='ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
45+
'uppercase name' => array( array( "SET @@SQL_MODE='ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
46+
':=' => array( array( "SET sql_mode:='ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
47+
'line breaks' => array( array( "SET\nsql_mode\n=\n'ANSI_QUOTES'\n" ), 'ANSI_QUOTES' ),
48+
49+
// A later assignment replaces the modes.
50+
'empty string' => array( array( "SET sql_mode = 'ANSI_QUOTES'", "SET sql_mode = ''" ), '' ),
51+
'zero' => array( array( "SET sql_mode = 'ANSI_QUOTES'", 'SET sql_mode = 0' ), '' ),
52+
'another mode' => array( array( "SET sql_mode = 'ANSI_QUOTES'", "SET sql_mode = 'IGNORE_SPACE'" ), 'IGNORE_SPACE' ),
53+
'a mode that the lexer ignores' => array( array( "SET sql_mode = 'ANSI_QUOTES'", 'SET sql_mode = traditional' ), '' ),
54+
'DEFAULT' => array( array( "SET sql_mode = 'ANSI_QUOTES'", 'SET sql_mode = DEFAULT' ), '' ),
55+
56+
// An expression can edit the current modes.
57+
'CONCAT' => array( array( "SET sql_mode = 'IGNORE_SPACE'", "SET sql_mode = CONCAT(@@sql_mode, ',ANSI_QUOTES')" ), 'ANSI_QUOTES,IGNORE_SPACE' ),
58+
'CONCAT in a subquery' => array( array( "SET sql_mode=(SELECT CONCAT(@@sql_mode, ',PIPES_AS_CONCAT'))" ), 'PIPES_AS_CONCAT' ),
59+
'sys.LIST_ADD' => array( array( "SET sql_mode = sys.LIST_ADD(@@sql_mode, 'ANSI_QUOTES')" ), 'ANSI_QUOTES' ),
60+
'sys.LIST_DROP' => array( array( "SET sql_mode = 'ANSI_QUOTES,IGNORE_SPACE'", "SET sql_mode = sys.LIST_DROP(@@sql_mode, 'ANSI_QUOTES')" ), 'IGNORE_SPACE' ),
61+
'adding a mode twice' => array( array( "SET sql_mode = 'ANSI_QUOTES'", "SET sql_mode = sys.LIST_ADD(@@sql_mode, 'ANSI_QUOTES')" ), 'ANSI_QUOTES' ),
62+
63+
// A user variable can save and restore the modes.
64+
'SET saves' => array(
65+
array( "SET sql_mode = 'ANSI_QUOTES'", 'SET @saved = @@sql_mode', "SET sql_mode = ''", 'SET sql_mode = @saved' ),
66+
'ANSI_QUOTES',
67+
),
68+
'SET saves @@session.' => array(
69+
array( "SET sql_mode = 'ANSI_QUOTES'", 'SET @saved = @@session.sql_mode', "SET sql_mode = ''", 'SET sql_mode = @saved' ),
70+
'ANSI_QUOTES',
71+
),
72+
'SELECT INTO saves' => array(
73+
array( "SET sql_mode = 'ANSI_QUOTES'", 'SELECT @@sql_mode INTO @saved', "SET sql_mode = ''", 'SET sql_mode = @saved' ),
74+
'ANSI_QUOTES',
75+
),
76+
'SELECT INTO saves @@session.' => array(
77+
array( "SET sql_mode = 'ANSI_QUOTES'", 'select @@session.sql_mode into @saved', "SET sql_mode = ''", 'SET sql_mode = @saved' ),
78+
'ANSI_QUOTES',
79+
),
80+
'variable names are case-insensitive' => array(
81+
array( "SET sql_mode = 'ANSI_QUOTES'", 'SET @Saved = @@sql_mode', "SET sql_mode = ''", 'SET sql_mode = @SAVED' ),
82+
'ANSI_QUOTES',
83+
),
84+
'one assignment saves, another sets' => array(
85+
array( "SET sql_mode = 'IGNORE_SPACE'", "SET @saved = @@sql_mode, sql_mode = 'ANSI_QUOTES'", 'SET sql_mode = @saved' ),
86+
'IGNORE_SPACE',
87+
),
88+
89+
// Other assignments can be in the same statement.
90+
'an assignment after' => array( array( "SET sql_mode = 'ANSI_QUOTES', @a = 1" ), 'ANSI_QUOTES' ),
91+
'an assignment before' => array( array( "SET @a = 1, sql_mode = 'ANSI_QUOTES'" ), 'ANSI_QUOTES' ),
92+
'a comma in a string' => array( array( "SET @a = 'b,sql_mode=ANSI_QUOTES', sql_mode = 'IGNORE_SPACE'" ), 'IGNORE_SPACE' ),
93+
'a comma in parentheses' => array( array( "SET @a = CONCAT('b', 'c'), sql_mode = 'IGNORE_SPACE'" ), 'IGNORE_SPACE' ),
94+
95+
// A query can have several statements.
96+
'several statements' => array( array( "SET sql_mode = 'ANSI_QUOTES'; SELECT 1; SET sql_mode = CONCAT(@@sql_mode, ',IGNORE_SPACE')" ), 'ANSI_QUOTES,IGNORE_SPACE' ),
97+
'an assignment before a routine' => array( array( "SET sql_mode = 'ANSI_QUOTES';\nCREATE PROCEDURE p() BEGIN SELECT 1; END" ), 'ANSI_QUOTES' ),
98+
99+
// A routine doesn't run when it's created.
100+
'a procedure body' => array( array( "CREATE PROCEDURE p() SET sql_mode = 'ANSI_QUOTES'" ), '' ),
101+
'a function body' => array( array( "CREATE FUNCTION f() RETURNS INT BEGIN SET sql_mode = 'ANSI_QUOTES'; RETURN 1; END" ), '' ),
102+
'a trigger body' => array( array( "CREATE TRIGGER t BEFORE INSERT ON a FOR EACH ROW SET sql_mode = 'ANSI_QUOTES'" ), '' ),
103+
'an event body' => array( array( "CREATE EVENT e ON SCHEDULE EVERY 1 DAY DO SET sql_mode = 'ANSI_QUOTES'" ), '' ),
104+
'a body with a definer' => array( array( "CREATE DEFINER = root@localhost PROCEDURE p() SET sql_mode = 'ANSI_QUOTES'" ), '' ),
105+
'a body in a later statement' => array( array( "DROP PROCEDURE p; CREATE PROCEDURE p() BEGIN SELECT 1; SET sql_mode = 'ANSI_QUOTES'; END" ), '' ),
106+
107+
// Other queries don't change the modes.
108+
'reading the modes' => array( array( "SET sql_mode = 'ANSI_QUOTES'", 'SELECT @@sql_mode' ), 'ANSI_QUOTES' ),
109+
'a column with that name' => array( array( "SET sql_mode = 'ANSI_QUOTES'", "UPDATE t SET sql_mode = ''" ), 'ANSI_QUOTES' ),
110+
'another variable' => array( array( "SET sql_mode = 'ANSI_QUOTES'", "SET my_sql_mode = ''" ), 'ANSI_QUOTES' ),
111+
'a modes string in another query' => array( array( "SELECT 'SET sql_mode = ANSI_QUOTES'" ), '' ),
112+
113+
// A value that can't be evaluated keeps the modes.
114+
'an unknown variable' => array( array( "SET sql_mode = 'ANSI_QUOTES'", 'SET sql_mode = @unknown' ), 'ANSI_QUOTES' ),
115+
'a number' => array( array( "SET sql_mode = 'ANSI_QUOTES'", 'SET sql_mode = 2097152' ), 'ANSI_QUOTES' ),
116+
'an expression' => array( array( "SET sql_mode = 'ANSI_QUOTES'", 'SET sql_mode = 32+(65536*4)' ), 'ANSI_QUOTES' ),
117+
);
118+
}
119+
120+
/**
121+
* @dataProvider data_global_modes
122+
*/
123+
public function test_global_modes_apply_to_new_connections( string $assignment, string $current, string $connected ): void {
124+
$sql_modes = new Query_Corpus_SQL_Modes();
125+
$sql_modes->run_query( "SET GLOBAL sql_mode = 'IGNORE_SPACE'" );
126+
$sql_modes->run_query( $assignment );
127+
$this->assertSame( $current, $sql_modes->get_modes(), 'The current session' );
128+
129+
$sql_modes->run_command( 'connect (con1,localhost,root,,)' );
130+
$this->assertSame( $connected, $sql_modes->get_modes(), 'A new session' );
131+
}
132+
133+
public function data_global_modes(): array {
134+
return array(
135+
'GLOBAL' => array( "SET GLOBAL sql_mode = 'ANSI_QUOTES'", '', 'ANSI_QUOTES' ),
136+
'@@global.' => array( "SET @@global.sql_mode = 'ANSI_QUOTES'", '', 'ANSI_QUOTES' ),
137+
'DEFAULT has no lexer mode' => array( 'SET GLOBAL sql_mode = DEFAULT', '', '' ),
138+
'a session DEFAULT' => array( 'SET sql_mode = DEFAULT', 'IGNORE_SPACE', 'IGNORE_SPACE' ),
139+
'reading the global modes' => array( 'SET sql_mode = @@global.sql_mode', 'IGNORE_SPACE', 'IGNORE_SPACE' ),
140+
'a session assignment' => array( "SET sql_mode = 'ANSI_QUOTES'", 'ANSI_QUOTES', 'IGNORE_SPACE' ),
141+
'global from session modes' => array( "SET sql_mode = 'ANSI_QUOTES'; SET GLOBAL sql_mode = @@sql_mode", 'ANSI_QUOTES', 'ANSI_QUOTES' ),
142+
);
143+
}
144+
145+
public function test_each_connection_has_its_own_modes(): void {
146+
$sql_modes = new Query_Corpus_SQL_Modes();
147+
$sql_modes->run_query( "SET sql_mode = 'ANSI_QUOTES'" );
148+
149+
$sql_modes->run_command( 'connect (con1,localhost,root,,)' );
150+
$this->assertSame( '', $sql_modes->get_modes() );
151+
$sql_modes->run_query( "SET sql_mode = 'IGNORE_SPACE'" );
152+
153+
$sql_modes->run_command( 'connection default' );
154+
$this->assertSame( 'ANSI_QUOTES', $sql_modes->get_modes() );
155+
156+
$sql_modes->run_command( 'connection con1' );
157+
$this->assertSame( 'IGNORE_SPACE', $sql_modes->get_modes() );
158+
}
159+
160+
/**
161+
* @dataProvider data_commands
162+
*/
163+
public function test_commands_select_connections( string $connect, string $connection ): void {
164+
$sql_modes = new Query_Corpus_SQL_Modes();
165+
$sql_modes->run_command( $connect );
166+
$sql_modes->run_query( "SET sql_mode = 'ANSI_QUOTES'" );
167+
168+
$sql_modes->run_command( 'connection default' );
169+
$this->assertSame( '', $sql_modes->get_modes(), $connect );
170+
171+
$sql_modes->run_command( $connection );
172+
$this->assertSame( 'ANSI_QUOTES', $sql_modes->get_modes(), $connection );
173+
}
174+
175+
public function data_commands(): array {
176+
return array(
177+
'mysqltest commands' => array( 'connect (con1,localhost,root,,)', 'connection con1' ),
178+
'-- commands' => array( '--connect (con1,localhost,root,,)', '--connection con1' ),
179+
'no space' => array( '--connect(con1,localhost,root,,)', 'connection con1' ),
180+
'spaces and uppercase' => array( 'CONNECT ( con1 , localhost, root,,)', '--CONNECTION con1 ' ),
181+
'a line break' => array( "connect (con1,\nlocalhost,root,,)", 'connection con1' ),
182+
);
183+
}
184+
185+
public function test_a_connection_that_the_file_did_not_open_has_the_global_modes(): void {
186+
$sql_modes = new Query_Corpus_SQL_Modes();
187+
$sql_modes->run_query( "SET GLOBAL sql_mode = 'ANSI_QUOTES'" );
188+
$sql_modes->run_command( 'connection opened_in_an_include_file' );
189+
$this->assertSame( 'ANSI_QUOTES', $sql_modes->get_modes() );
190+
}
191+
192+
public function test_opening_a_connection_again_starts_a_new_session(): void {
193+
$sql_modes = new Query_Corpus_SQL_Modes();
194+
$sql_modes->run_command( 'connect (con1,localhost,root,,)' );
195+
$sql_modes->run_query( "SET sql_mode = 'ANSI_QUOTES'" );
196+
$sql_modes->run_command( 'connection default' );
197+
$sql_modes->run_command( 'connect (con1,localhost,root,,)' );
198+
$this->assertSame( '', $sql_modes->get_modes() );
199+
}
200+
201+
public function test_other_commands_keep_the_connection(): void {
202+
$sql_modes = new Query_Corpus_SQL_Modes();
203+
$sql_modes->run_query( "SET sql_mode = 'ANSI_QUOTES'" );
204+
foreach ( array( '--echo connection con1', '--disconnect con1', 'disconnect con1', '--source include/connect.inc' ) as $command ) {
205+
$sql_modes->run_command( $command );
206+
$this->assertSame( 'ANSI_QUOTES', $sql_modes->get_modes(), $command );
207+
}
208+
}
209+
210+
/**
211+
* @dataProvider data_session_resets
212+
*/
213+
public function test_session_resets_read_the_global_modes( string $command ): void {
214+
$sql_modes = new Query_Corpus_SQL_Modes();
215+
$sql_modes->run_query( "SET GLOBAL sql_mode = 'IGNORE_SPACE'" );
216+
$sql_modes->run_query( "SET sql_mode = 'ANSI_QUOTES'" );
217+
$sql_modes->run_command( $command );
218+
$this->assertSame( 'IGNORE_SPACE', $sql_modes->get_modes(), $command );
219+
}
220+
221+
public function data_session_resets(): array {
222+
return array(
223+
'reset_connection' => array( 'reset_connection' ),
224+
'--reset_connection' => array( '--reset_connection' ),
225+
'change_user' => array( 'change_user root' ),
226+
'--change_user' => array( '--change_user root,,test' ),
227+
);
228+
}
229+
}

‎packages/mysql-parser/tests/WP_MySQL_Server_Suite_Parser_Tests.php‎

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class WP_MySQL_Server_Suite_Parser_Tests extends TestCase {
1919
* set is pinned in FAILURES_PATH; update it when the accepted language
2020
* legitimately changes.
2121
*/
22-
const EXPECTED_QUERIES = 69076;
23-
const EXPECTED_FAILURES = 63;
22+
const EXPECTED_QUERIES = 69319;
23+
const EXPECTED_FAILURES = 43;
2424

2525
public function test_corpus_acceptance_rate(): void {
2626
$parser = WP_MySQL_Parser_Factory::create_parser();
@@ -36,7 +36,8 @@ public function test_corpus_acceptance_rate(): void {
3636
++$total;
3737

3838
// Pin the MySQL version. The failure set in FAILURES_PATH depends on it.
39-
$tokens = ( new WP_MySQL_Lexer( $query, 80410 ) )->remaining_tokens();
39+
$sql_modes = isset( $record[1] ) ? explode( ',', $record[1] ) : array();
40+
$tokens = ( new WP_MySQL_Lexer( $query, 80410, $sql_modes ) )->remaining_tokens();
4041
if ( null === $parser->parse( $tokens ) ) {
4142
$failures[] = $query;
4243
}
@@ -88,6 +89,39 @@ public function data_query_texts(): array {
8889
);
8990
}
9091

92+
/**
93+
* Pin the SQL modes of queries that test files select them for in different ways,
94+
* because the tally can't see a change in the modes of a query that still parses.
95+
*
96+
* @dataProvider data_query_sql_modes
97+
*/
98+
public function test_corpus_stores_query_sql_modes( string $query, array $expected ): void {
99+
static $sql_modes = null;
100+
if ( null === $sql_modes ) {
101+
$sql_modes = array();
102+
foreach ( $this->read_records( self::CORPUS_PATH ) as $record ) {
103+
$sql_modes[ $record[0] ][] = $record[1] ?? '';
104+
}
105+
}
106+
$this->assertSame( $expected, $sql_modes[ $query ] ?? array() );
107+
}
108+
109+
/**
110+
* @return array<string,array{0:string,1:string[]}>
111+
*/
112+
public function data_query_sql_modes(): array {
113+
return array(
114+
'no modes' => array( "DO 1 /*!80034\n+1*/", array( '' ) ),
115+
'SET sql_mode' => array( 'SELECT * from "full"', array( 'ANSI_QUOTES' ) ),
116+
'the ANSI mode' => array( 'create table t1 ("a*b" int)', array( 'ANSI_QUOTES,IGNORE_SPACE,PIPES_AS_CONCAT' ) ),
117+
'CONCAT(@@sql_mode)' => array( "SELECT 'a%' LIKE 'a!%' ESCAPE '!', 'a%' LIKE 'a!' || '%' ESCAPE '!'", array( 'PIPES_AS_CONCAT' ) ),
118+
'sys.LIST_ADD' => array( 'select "$id2", "$$$" from t where t."$id" = 0', array( 'ANSI_QUOTES' ) ),
119+
'NO_BACKSLASH_ESCAPES' => array( "INSERT INTO t1 (id, val1) VALUES (1, '\\aa')", array( 'NO_BACKSLASH_ESCAPES', '' ) ),
120+
'two sets of modes' => array( 'select * from t1 where not a between 2 and 3', array( 'HIGH_NOT_PRECEDENCE', '' ) ),
121+
'IGNORE_SPACE' => array( 'create table ADDDATE (a int)', array( '', 'IGNORE_SPACE' ) ),
122+
);
123+
}
124+
91125
/**
92126
* Read the pinned set of failing queries, sorted to match the live set.
93127
*
@@ -106,16 +140,26 @@ private function read_expected_failures(): array {
106140
* @return string[] The queries.
107141
*/
108142
private function read_queries( string $path ): array {
143+
return array_column( $this->read_records( $path ), 0 );
144+
}
145+
146+
/**
147+
* Read the records of the queries in a CSV file.
148+
*
149+
* @param string $path The path to the CSV file.
150+
* @return array<int,string[]> The records.
151+
*/
152+
private function read_records( string $path ): array {
109153
$handle = fopen( $path, 'r' );
110-
$queries = array();
154+
$records = array();
111155
while ( ( $record = fgetcsv( $handle, null, ',', '"', '\\' ) ) !== false ) {
112156
$query = $record[0] ?? null;
113157
if ( null === $query || '' === $query ) {
114158
continue;
115159
}
116-
$queries[] = $query;
160+
$records[] = $record;
117161
}
118162
fclose( $handle );
119-
return $queries;
163+
return $records;
120164
}
121165
}

‎packages/mysql-parser/tests/benchmark.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function ( $severity, $message, $file, $line ) {
6060
if ( null === $query || '' === $query ) {
6161
continue;
6262
}
63-
$queries[] = $query;
63+
$queries[] = array( $query, isset( $record[1] ) ? explode( ',', $record[1] ) : array() );
6464
if ( null !== $limit && count( $queries ) >= $limit ) {
6565
break;
6666
}
@@ -75,9 +75,9 @@ function ( $severity, $message, $file, $line ) {
7575
$run_pass = function () use ( $queries, $parser, &$failures, &$exceptions ) {
7676
$failures = 0;
7777
$exceptions = 0;
78-
foreach ( $queries as $query ) {
78+
foreach ( $queries as list( $query, $sql_modes ) ) {
7979
try {
80-
$tokens = ( new WP_MySQL_Lexer( $query ) )->remaining_tokens();
80+
$tokens = ( new WP_MySQL_Lexer( $query, 80410, $sql_modes ) )->remaining_tokens();
8181
if ( null !== $parser && null === $parser->parse( $tokens ) ) {
8282
++$failures;
8383
}

0 commit comments

Comments
 (0)