Closed quasilyte closed 5 years ago
Relevant comment: https://github.com/VKCOM/noverify/pull/108#issuecomment-497758847 Seems like it's not an issue.
As @YuriyNasretdinov mentioned, it is a way to represent skipped elements in a list
.
Unfortunately array
and list
use the same syntax rules to parse their items, so PHP engine checks empty elements at the compile phase https://github.com/php/php-src/blob/775e86344f05f3332463003230ef93df8167ab6c/Zend/zend_compile.c#L7666
Thanks. That resolves my question.
At some point, php parser started to parse
[1, 2,]
as array of 3 elements where the last array element consisting of key=nil and val=nil.If we dig further, it also parses something like
[,,,]
as an array of 4 (empty) elements.Is it intended behavior?