Describe the bug
Some PHP files could not be parsed
To Reproduce
$ semgrep --config semgrep.yaml -v elFinder.class.phpExpected behavior
The files should be parsed
Screenshots

Other Affected Files
Environment
Running v0.27.0 on MacOSX 10.15.6 (installed via Brew)
Hi @erwanlr,
Thanks for bringing this to our attention. I'll investigate and get back to you.
This seems like a bug in our PHP parsing. Pulling in @aryx.
Appears to be related to the $var[] = $val array shorthand?
@vortfu $var[] = $val is how you append to arrays in PHP
@vortfu
$var[] = $valis how you append to arrays in PHP
I understand what the code does, but I think it's what is causing this parse error in semgrep/pfff :)
Minimalized test case as follows:
vortfu:~ vortfu$ cat semgrep-parse-error-001.php
<?php
$x = array();
$x[] = 1;
vortfu:~ vortfu$ php -l semgrep-parse-error-001.php
No syntax errors detected in semgrep-parse-error-001.php
vortfu:~ vortfu$ semgrep --version
0.27.0
vortfu:~ vortfu$ semgrep --verbose semgrep-parse-error-001.php
running 1 rules...
semgrep warn: parse error
--> semgrep-parse-error-001.php:1
1 | <?php
|
= help: If the code appears to be valid, this may be a semgrep bug.
Could not parse semgrep-parse-error-001.php as php
ran 1 rules on 1 files: 0 findings
1 files could not be analyzed; run with --verbose for details or run with --strict to exit non-zero if any file cannot be analyzed
Thx a lot for the minimal test @vortfu
Yes internally semgrep is parsing correctly the file, but the part that transform the PHP program in a generic AST has some TODOs related to those assignments. I'll fix it.
Most helpful comment
I understand what the code does, but I think it's what is causing this parse error in semgrep/pfff :)
Minimalized test case as follows: