Skip to content

Fix hex string literal (x'...') parsing in CREATE TABLE DEFAULT values#650

Open
predictor2718 wants to merge 5 commits intophpmyadmin:5.11.xfrom
predictor2718:fix/hex-literal-default
Open

Fix hex string literal (x'...') parsing in CREATE TABLE DEFAULT values#650
predictor2718 wants to merge 5 commits intophpmyadmin:5.11.xfrom
predictor2718:fix/hex-literal-default

Conversation

@predictor2718
Copy link
Copy Markdown
Contributor

Summary

  • The lexer incorrectly tokenized x'...' hex string literals as two separate tokens (keyword x + string
    '...'), producing invalid SQL x AS '...' on rebuild
  • Added states 11-13 to the number parsing state machine (analogous to states 7-9 for b'...' binary literals) to
    recognize x'...' and X'...' as single hex string literal tokens
  • Added FLAG_NUMBER_HEX_STRING to prevent incorrect hexdec() conversion of the token value

Fixes #649

Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.93%. Comparing base (4c45eac) to head (5081e1b).

Additional details and impacted files
@@             Coverage Diff              @@
##             5.11.x     #650      +/-   ##
============================================
+ Coverage     96.92%   96.93%   +0.01%     
- Complexity     2316     2331      +15     
============================================
  Files            71       71              
  Lines          5110     5128      +18     
============================================
+ Hits           4953     4971      +18     
  Misses          157      157              
Flag Coverage Δ
unit-7.2-ubuntu-latest 96.93% <100.00%> (+0.01%) ⬆️
unit-7.3-ubuntu-latest 96.92% <100.00%> (+0.01%) ⬆️
unit-7.4-ubuntu-latest 96.90% <100.00%> (+0.01%) ⬆️
unit-8.0-ubuntu-latest 96.92% <100.00%> (+0.01%) ⬆️
unit-8.1-ubuntu-latest 96.92% <100.00%> (+0.01%) ⬆️
unit-8.2-ubuntu-latest 96.86% <95.00%> (-0.01%) ⬇️
unit-8.3-ubuntu-latest 96.86% <95.00%> (-0.01%) ⬇️
unit-8.4-ubuntu-latest 96.86% <95.00%> (-0.01%) ⬇️
unit-8.5-ubuntu-latest 96.86% <95.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.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.

1 participant