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
[Expression Language] Null coalescing operator doesn't work? #54359
Comments
The problem is not the operator but the fact you cannot reference variables you haven’t passed in an expression. What is your use-case for doing so? |
@MatTheCat Acting on a variable hashmap If it's not possible, I'll understand, but docs specifically mention this usecase: https://symfony.com/doc/current/components/expression_language.html#null-coalescing-operator Right first example is
(emphasis mine) |
@MatTheCat I'm not using it as a part of Symfony, so I wasn't sure where to post it; Will post it in docs |
closing in favour of the docs issue |
@xabbuh I hoped for "that should work" tbh 😂 |
Symfony version(s) affected
7.0
Description
According to docs, we can use null-coalescing operator to provide fallback to potentially empty or even nonexistent variables. However I can't make it work, even in a simple file with nothing but Expression Language.
How to reproduce
(In the reproduction I have suppressed the throws, but every evaluate fails with
Fatal error: Uncaught Symfony\Component\ExpressionLanguage\SyntaxError: Variable "notexists" is not valid around position …
Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: