Skip to content

Commit ab08669

Browse files
committed
Merge branch '5.8.x'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents b737500 + 0eda5b6 commit ab08669

File tree

7 files changed

+164
-95
lines changed

7 files changed

+164
-95
lines changed

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Fix `ALTER TABLE … MODIFY … ENUM('<reserved_keyword>')` is being wrongly parsed (#478)
1414
- Fix MariaDB window function with alias gives bad linting errors (#283)
1515
- Fix unrecognized keyword `COLLATE` in `WHERE` clauses (#491)
16+
- Fix invalid hexadecimal prefix 0X (#508)
1617

1718
## [5.8.0] - 2023-06-05
1819

‎src/Lexer.php‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,10 +813,7 @@ public function parseNumber(): Token|null
813813
} elseif (
814814
$this->last + 1 < $this->len
815815
&& $this->str[$this->last] === '0'
816-
&& (
817-
$this->str[$this->last + 1] === 'x'
818-
|| $this->str[$this->last + 1] === 'X'
819-
)
816+
&& $this->str[$this->last + 1] === 'x'
820817
) {
821818
$token .= $this->str[$this->last++];
822819
$state = 2;

‎tests/Misc/BugsTest.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public static function bugProvider(): array
2525
['bugs/gh14'],
2626
['bugs/gh16'],
2727
['bugs/gh317'],
28+
['bugs/gh508'],
2829
['bugs/pma11800'],
2930
['bugs/pma11836'],
3031
['bugs/pma11843'],

‎tests/data/bugs/gh508.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0X0F

‎tests/data/bugs/gh508.out‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"query": "0X0F",
3+
"lexer": {
4+
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
5+
"str": "0X0F",
6+
"len": 4,
7+
"last": 4,
8+
"list": {
9+
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
10+
"tokens": [
11+
{
12+
"@type": "PhpMyAdmin\\SqlParser\\Token",
13+
"token": "0X0F",
14+
"value": "0X0F",
15+
"keyword": null,
16+
"type": 0,
17+
"flags": 0,
18+
"position": 0
19+
},
20+
{
21+
"@type": "PhpMyAdmin\\SqlParser\\Token",
22+
"token": null,
23+
"value": null,
24+
"keyword": null,
25+
"type": 9,
26+
"flags": 0,
27+
"position": null
28+
}
29+
],
30+
"count": 2,
31+
"idx": 2
32+
},
33+
"delimiter": ";",
34+
"delimiterLen": 1,
35+
"strict": false,
36+
"errors": []
37+
},
38+
"parser": {
39+
"@type": "PhpMyAdmin\\SqlParser\\Parser",
40+
"list": {
41+
"@type": "@1"
42+
},
43+
"statements": [],
44+
"brackets": 0,
45+
"strict": false,
46+
"errors": []
47+
},
48+
"errors": {
49+
"lexer": [],
50+
"parser": [
51+
[
52+
"Unexpected beginning of statement.",
53+
{
54+
"@type": "@2"
55+
},
56+
0
57+
]
58+
]
59+
}
60+
}

‎tests/data/lexer/lexNumber.in‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, 0XFfA, -0xFFa, -0xfFA, -0XFfA, 1e-10, 1e10, .5e10, b'10';
2-
-- invalid number
3-
SELECT 12ex10, b'15';
1+
SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, -0xFFa, -0xfFA, 1e-10, 1e10, .5e10, b'10';
2+
-- invalid numbers
3+
SELECT 12ex10, b'15', 0XFfA, -0XFfA;

0 commit comments

Comments
 (0)