Skip to content

Commit

Permalink
Fixes #299 - array_key_exists warning when parsing a "DEFAULT FALSE" …
Browse files Browse the repository at this point in the history
…token

Signed-off-by: Saksham Gupta <shucon01@gmail.com>
  • Loading branch information
shucon authored and williamdes committed Oct 13, 2020
1 parent b2467ef commit ce56f16
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Components/AlterOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
}
$state = 2;
} elseif ($state === 2) {
$array_key = '';
if (is_string($token->value) || is_numeric($token->value)) {
$array_key = $token->value;
} else {
$array_key = $token->token;
}
if ($token->type === Token::TYPE_OPERATOR) {
if ($token->value === '(') {
++$brackets;
Expand All @@ -282,9 +288,9 @@ public static function parse(Parser $parser, TokensList $list, array $options =
);
break;
}
} elseif ((array_key_exists($token->value, self::$DB_OPTIONS)
|| array_key_exists($token->value, self::$TABLE_OPTIONS))
&& ! self::checkIfColumnDefinitionKeyword($token->value)
} elseif ((array_key_exists($array_key, self::$DB_OPTIONS)
|| array_key_exists($array_key, self::$TABLE_OPTIONS))
&& ! self::checkIfColumnDefinitionKeyword($array_key)
) {
// This alter operation has finished, which means a comma was missing before start of new alter operation
$parser->error(
Expand Down

0 comments on commit ce56f16

Please sign in to comment.