z7zmey / php-parser

PHP parser written in Go

Home Page:https://php-parser.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[dev] syntax error: unexpected T_STRING at line 5

ruudk opened this issue · comments

Found a problem with the following code using the dev branch:

<?php

declare(strict_types=1);

$a = "JSON_MERGE('{\"vat\"}')";

results in:

syntax error: unexpected T_STRING at line 5

More examples:

<?php $a = "{\"";
# s`syntax error: unexpected '"' at line 1`,
<?php $a = "{\"\"}";
# s"syntax error: unexpected T_NS_SEPARATOR at line 1",
<?php $a = "{\"}";
// panic: runtime error: index out of range [0] with length 0 [recovered]

Thanks, it's working now!