Skip to content

Parser crashes on obscure PHP list syntax with missing arguments #44

@tylerchr

Description

@tylerchr

I discovered today that the parser fails with an "index out of range" runtime error when it encounters the following PHP code:

<?php
$things = ["foo", "bar"];
list(, $bar) = $things;

Surprisingly, this is valid PHP code (running it results in bar).

php-parser gets really unhappy about the lack of a first argument though:

panic: runtime error: index out of range

I almost feel bad reporting this because it's such bad PHP code, but it's nonetheless valid and should probably at least not crash the parser.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions