Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

length with @root is causing parse error #370

Open
Dahkon opened this issue Mar 13, 2024 · 0 comments
Open

length with @root is causing parse error #370

Dahkon opened this issue Mar 13, 2024 · 0 comments

Comments

@Dahkon
Copy link

Dahkon commented Mar 13, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant