Skip to content

length with @root is causing parse error #370

Open
@Dahkon

Description

@Dahkon

To reproduce the problem juste use this line of code :
{{@root.datas.length}}

datas.length is working good but when you use @root in front is causing a Synthax Error in the generated php file.

As a workaround, I found in Compiler.php file in line 313 to replace code :

        if (!$spvar) {
            if (($levels === 0) && $p) {
                $checks[] = "isset($base$p)";
            }
            $checks[] = ("$base$p" == '$in') ? '$inary' : "is_array($base$p)";
        }

with the following :

        if ($spvar) {
            if ($p) {
                $checks[] = "isset($base$p)";
            }
        } else {
            if (($levels === 0) && $p) {
                $checks[] = "isset($base$p)";
            }
            $checks[] = ("$base$p" == '$in') ? '$inary' : "is_array($base$p)";
        }

Seems ok for me.

But I don't know any resulting bugs of this code.

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