Skip to content

Commit

Permalink
Fix #13951 wrong parsing partitions
Browse files Browse the repository at this point in the history
When partition names contain "_", the parser wasn't reading the full name, but stopped before the first "_".

Signed-off-by: Hugues Peccatte <hugues.peccatte@aareon.fr>
  • Loading branch information
Hugues Peccatte committed Oct 31, 2019
1 parent 49731d2 commit fe98a34
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Components/PartitionDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,16 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$ret->name = $token->value;

// Looking ahead for a 'VALUES' keyword.
$idx = $list->idx;
$list->getNext();
$nextToken = $list->getNext();
$list->idx = $idx;
// Loop until the end of the partition name (delimited by a whitespace)
while ($nextToken = $list->tokens[++$list->idx]) {
if ($nextToken->type === Token::TYPE_WHITESPACE) {
break;
}
$ret->name .= $nextToken->value;
}
$idx = $list->idx--;
// Get the first token after the white space.
$nextToken = $list->tokens[++$idx];

$state = ($nextToken->type === Token::TYPE_KEYWORD)
&& ($nextToken->value === 'VALUES')
Expand Down

0 comments on commit fe98a34

Please sign in to comment.