Skip to content

Commit

Permalink
Merge branch '5.8.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Sep 15, 2023
2 parents b737500 + 0eda5b6 commit ab08669
Show file tree
Hide file tree
Showing 7 changed files with 164 additions and 95 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@
- Fix `ALTER TABLE … MODIFY … ENUM('<reserved_keyword>')` is being wrongly parsed (#478)
- Fix MariaDB window function with alias gives bad linting errors (#283)
- Fix unrecognized keyword `COLLATE` in `WHERE` clauses (#491)
- Fix invalid hexadecimal prefix 0X (#508)

## [5.8.0] - 2023-06-05

Expand Down
5 changes: 1 addition & 4 deletions src/Lexer.php
Expand Up @@ -813,10 +813,7 @@ public function parseNumber(): Token|null
} elseif (
$this->last + 1 < $this->len
&& $this->str[$this->last] === '0'
&& (
$this->str[$this->last + 1] === 'x'
|| $this->str[$this->last + 1] === 'X'
)
&& $this->str[$this->last + 1] === 'x'
) {
$token .= $this->str[$this->last++];
$state = 2;
Expand Down
1 change: 1 addition & 0 deletions tests/Misc/BugsTest.php
Expand Up @@ -25,6 +25,7 @@ public static function bugProvider(): array
['bugs/gh14'],
['bugs/gh16'],
['bugs/gh317'],
['bugs/gh508'],
['bugs/pma11800'],
['bugs/pma11836'],
['bugs/pma11843'],
Expand Down
1 change: 1 addition & 0 deletions tests/data/bugs/gh508.in
@@ -0,0 +1 @@
0X0F
60 changes: 60 additions & 0 deletions tests/data/bugs/gh508.out
@@ -0,0 +1,60 @@
{
"query": "0X0F",
"lexer": {
"@type": "PhpMyAdmin\\SqlParser\\Lexer",
"str": "0X0F",
"len": 4,
"last": 4,
"list": {
"@type": "PhpMyAdmin\\SqlParser\\TokensList",
"tokens": [
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": "0X0F",
"value": "0X0F",
"keyword": null,
"type": 0,
"flags": 0,
"position": 0
},
{
"@type": "PhpMyAdmin\\SqlParser\\Token",
"token": null,
"value": null,
"keyword": null,
"type": 9,
"flags": 0,
"position": null
}
],
"count": 2,
"idx": 2
},
"delimiter": ";",
"delimiterLen": 1,
"strict": false,
"errors": []
},
"parser": {
"@type": "PhpMyAdmin\\SqlParser\\Parser",
"list": {
"@type": "@1"
},
"statements": [],
"brackets": 0,
"strict": false,
"errors": []
},
"errors": {
"lexer": [],
"parser": [
[
"Unexpected beginning of statement.",
{
"@type": "@2"
},
0
]
]
}
}
6 changes: 3 additions & 3 deletions tests/data/lexer/lexNumber.in
@@ -1,3 +1,3 @@
SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, 0XFfA, -0xFFa, -0xfFA, -0XFfA, 1e-10, 1e10, .5e10, b'10';
-- invalid number
SELECT 12ex10, b'15';
SELECT 12, 34, 5.67, 0x89, -10, --11, +12, .15, 0xFFa, 0xfFA, -0xFFa, -0xfFA, 1e-10, 1e10, .5e10, b'10';
-- invalid numbers
SELECT 12ex10, b'15', 0XFfA, -0XFfA;

0 comments on commit ab08669

Please sign in to comment.