Skip to content

Commit a6d95ac

Browse files
committed
Merge branch '5.9.x'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents f7b6920 + 4e288e8 commit a6d95ac

File tree

5 files changed

+417
-8
lines changed

5 files changed

+417
-8
lines changed

phpstan-baseline.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ parameters:
201201
path: src/Components/Key.php
202202

203203
-
204-
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Limit\\:\\:\\$offset \\(int\\) does not accept mixed\\.$#"
204+
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Limit\\:\\:\\$offset \\(int\\|string\\) does not accept mixed\\.$#"
205205
count: 1
206206
path: src/Components/Limit.php
207207

208208
-
209-
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Limit\\:\\:\\$rowCount \\(int\\) does not accept mixed\\.$#"
209+
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Limit\\:\\:\\$rowCount \\(int\\|string\\) does not accept mixed\\.$#"
210210
count: 1
211211
path: src/Components/Limit.php
212212

src/Components/Limit.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ final class Limit implements Component
1818
/**
1919
* The number of rows skipped.
2020
*
21-
* @var int
21+
* @var int|string
2222
*/
2323
public $offset;
2424

2525
/**
2626
* The number of rows to be returned.
2727
*
28-
* @var int
28+
* @var int|string
2929
*/
3030
public $rowCount;
3131

3232
/**
33-
* @param int $rowCount the row count
34-
* @param int $offset the offset
33+
* @param int|string $rowCount the row count
34+
* @param int|string $offset the offset
3535
*/
3636
public function __construct($rowCount = 0, $offset = 0)
3737
{
@@ -85,8 +85,11 @@ public static function parse(Parser $parser, TokensList $list, array $options =
8585
continue;
8686
}
8787

88-
// Skip if not a number
89-
if (($token->type !== TokenType::Number)) {
88+
// Skip if not a number or a bind parameter (?)
89+
if (
90+
! ($token->type === TokenType::Number
91+
|| ($token->type === TokenType::Symbol && ($token->flags & Token::FLAG_SYMBOL_PARAMETER)))
92+
) {
9093
break;
9194
}
9295

tests/Misc/BugsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public static function bugProvider(): array
3434
['bugs/gh412'],
3535
['bugs/gh478'],
3636
['bugs/gh492'],
37+
['bugs/gh498'],
3738
['bugs/gh499'],
3839
['bugs/gh508'],
3940
['bugs/gh511'],

tests/data/bugs/gh498.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT ?
2+
FROM uno
3+
JOIN dos ON dos.id = uno.id
4+
LIMIT ? OFFSET ?

0 commit comments

Comments
 (0)