Skip to content

Fix parsing of backtick-enclosed table options#644

Open
Ryujiyasu wants to merge 1 commit intophpmyadmin:masterfrom
Ryujiyasu:fix/backtick-enclosed-table-options
Open

Fix parsing of backtick-enclosed table options#644
Ryujiyasu wants to merge 1 commit intophpmyadmin:masterfrom
Ryujiyasu:fix/backtick-enclosed-table-options

Conversation

@Ryujiyasu
Copy link

Summary

  • Fix parsing of backtick-enclosed table options such as `PAGE_COMPRESSED`=1 produced by MariaDB
  • When a backtick-enclosed symbol token is encountered, a lookahead checks for = to distinguish option assignments from regular quoted identifiers (table/column names)
  • Uses $token->value (without backticks) for the option name lookup only when confirmed as an option

How it works

In OptionsArrays::parse(), the option name lookup used $token->token which includes backticks for quoted symbols. MariaDB outputs table options like `PAGE_COMPRESSED`=1, so the backtick-enclosed name never matched the TABLE_OPTIONS array.

The fix adds a targeted check: if the token is a backtick-enclosed symbol and the next non-whitespace token is =, it uses the unquoted $token->value for the lookup. This prevents false matches where quoted identifiers (e.g. `database` in ALTER TABLE `database`.`table`) could collide with option names like DATABASE.

Test plan

  • Added testBuilderCompressedBackticks test for backtick-enclosed PAGE_COMPRESSED and PAGE_COMPRESSION_LEVEL
  • All 1004 existing tests pass with no regressions

Fixes #643

🤖 Generated with Claude Code

MariaDB encloses some table options in backticks by default
(e.g. `PAGE_COMPRESSED`=1). The option name lookup in
OptionsArrays::parse() used $token->token which includes the
backticks, causing the match against the options array to fail.

This adds a targeted check: when a backtick-enclosed symbol is
followed by '=', its unquoted value is used for the lookup.
A lookahead for '=' prevents regular quoted identifiers (such as
table or column names) from being mistaken for options.

Fixes phpmyadmin#643

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support PAGE_COMPRESSED=1`

1 participant