Skip to content

Commit ce56f16

Browse files
shuconwilliamdes
authored andcommitted
Fixes #299 - array_key_exists warning when parsing a "DEFAULT FALSE" token
Signed-off-by: Saksham Gupta <[email protected]>
1 parent b2467ef commit ce56f16

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Components/AlterOperation.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
263263
}
264264
$state = 2;
265265
} elseif ($state === 2) {
266+
$array_key = '';
267+
if (is_string($token->value) || is_numeric($token->value)) {
268+
$array_key = $token->value;
269+
} else {
270+
$array_key = $token->token;
271+
}
266272
if ($token->type === Token::TYPE_OPERATOR) {
267273
if ($token->value === '(') {
268274
++$brackets;
@@ -282,9 +288,9 @@ public static function parse(Parser $parser, TokensList $list, array $options =
282288
);
283289
break;
284290
}
285-
} elseif ((array_key_exists($token->value, self::$DB_OPTIONS)
286-
|| array_key_exists($token->value, self::$TABLE_OPTIONS))
287-
&& ! self::checkIfColumnDefinitionKeyword($token->value)
291+
} elseif ((array_key_exists($array_key, self::$DB_OPTIONS)
292+
|| array_key_exists($array_key, self::$TABLE_OPTIONS))
293+
&& ! self::checkIfColumnDefinitionKeyword($array_key)
288294
) {
289295
// This alter operation has finished, which means a comma was missing before start of new alter operation
290296
$parser->error(

0 commit comments

Comments
 (0)