question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

invalid ast for offsetlookup and encapsed

See original GitHub issue

Input:

$var = "string ${juices['FOO']} string";

Encapsedpart node contains variable node, but should contains offsetlookup node.

PHP parser output:

array(
    0: Stmt_Expression(
        expr: Expr_Assign(
            var: Expr_Variable(
                name: var
            )
            expr: Scalar_Encapsed(
                parts: array(
                    0: Scalar_EncapsedStringPart(
                        value: string 
                    )
                    1: Expr_ArrayDimFetch(
                        var: Expr_Variable(
                            name: juices
                        )
                        dim: Scalar_String(
                            value: FOO
                        )
                    )
                    2: Scalar_EncapsedStringPart(
                        value:  string
                    )
                )
            )
        )
    )
)

Expr_ArrayDimFetch is same as offsetlookup

Maybe will be great add tests for propertylookup and staticlookup to ensure ast correct for lookup nodes.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Sep 30, 2019

hm, maybe wen can refactor to one variable: “syntax: curly | dollar | null

  1. curly - "test {$test}";
  2. dollar - "test ${test}";
  3. null - "test $test";
1reaction
alexander-akaitcommented, Aug 19, 2019

Thanks, look on this at this week

Read more comments on GitHub >

github_iconTop Results From Across the Web

mutation issue with Unhandled Rejection (Error): Invalid AST ...
It provides me this error: Unhandled Rejection (Error): Invalid AST Node: [function sslCertsRenewalChecklistAddItemsQuery]. I search around and ...
Read more >
Changelog - php-parser
235 : invalid ast for self and parent ... 182 : strange with parens, staticlookup and offsetlookup ... 204 : [bug] invalid start...
Read more >
php-parser/CHANGELOG and php-parser Releases | LibHunt
:herb: NodeJS PHP Parser - extract AST or tokens ... #175 : impossible detect curly in encapsed AST enhancement; #210 : [bug] invalid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found