GeezerVison is showing github.com — Fixes #299 - array_key_exists warning when parsing a "DEFAULT FALSE" … · phpmyadmin/sql-parser@ce56f16
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/Components/AlterOperation.php +9-3Lines changed: 9 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -263,6 +263,12 @@ public static function parse(Parser $parser, TokensList $list, array $options = |
263 | 263 | } |
264 | 264 | $state = 2; |
265 | 265 | } 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 | + } |
266 | 272 | if ($token->type === Token::TYPE_OPERATOR) { |
267 | 273 | if ($token->value === '(') { |
268 | 274 | ++$brackets; |
@@ -282,9 +288,9 @@ public static function parse(Parser $parser, TokensList $list, array $options = |
282 | 288 | ); |
283 | 289 | break; |
284 | 290 | } |
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) |
288 | 294 | ) { |
289 | 295 | // This alter operation has finished, which means a comma was missing before start of new alter operation |
290 | 296 | $parser->error( |
|