php/php-langspec

Array initializer does not include in ','

zhujinxuan opened this issue · 1 comments

In PHP 7.3.0, the following code is legal:

$a = [,];

And the following code is legal in parser but illegal during runtime:

$a = [,,];

However, current array-initializer in 10-expressions.md and 19-grammar.md does not include , as an element.

If we want to describe this behavior in the langspec, then we need to change the definition of array-initializer to

array-initializer:
  array-initializer-list ','?
  ','

I can submit a PR if you think it is good to support this current behavior.

My mistake. It is a bug of psysh