Skip to content

Json Encoding fails on recursion when replaceNodes is disabled #1076

Open
@dhaeckel

Description

@dhaeckel

Hi @nikic,

I'm unable to dump a class AST in JSON when using the NameResolver and passing replaceNodes false, because of recursive refs. You can see an example at https://github.com/dhaeckel/php-parser-issue-repro, you have to execute vendor/bin/php-parse -N -j yaf.php and change the NameResolver options in vendor/nikic/php-parser/bin/php-parse to see the problem. A possible mitigation could be to clone already resolved names before returning to break the cyclic refs. See #1075 for a possible solution. Let me know, if you need anything from me.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions