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

Error The merge filter only works with arrays or "Traversable", got "integer" for argument 2 when not using the merge filter #3924

Open
ericmorand opened this issue Dec 2, 2023 · 0 comments

Comments

@ericmorand
Copy link
Contributor

ericmorand commented Dec 2, 2023

Whenever we try to spread an integer, we get this error about the merge filter.

https://twigfiddle.com/ud26jf

The merge filter only works with arrays or "Traversable", got "integer" for argument 2

Even though I suspect that internally TwigPHP depends on the merge filter to implement the spread operator, it is still wrong that the error message mentions a filter that is not used in the template.

The error message should be related to the code actually present and should be something like 5 is not iterable or 5 is neither an array nor a "Traversable".

@ericmorand ericmorand changed the title Error The merge filter only works with arrays or "Traversable", got "integer" for argument 2 while not using the merge filter Error The merge filter only works with arrays or "Traversable", got "integer" for argument 2 when not using the merge filter Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant