-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[ExpressionLanguage] Matches throws error for null values #45926
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
Comments
To me it looks sensible to return early if the token to match is null but not a string. |
Up for a PR @ausi? We should just accept null next to string and handle it as the empty string, since that's always been the behavior. |
Yes, will do. |
Done: #45928 |
fabpot
added a commit
that referenced
this issue
Apr 3, 2022
…xpression (ausi) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [ExpressionLanguage] Fix matching null against a regular expression | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #45926 | License | MIT | Doc PR | - As discussed in #45926 (comment) The bug was introduced by #45875 Commits ------- 3326da0 [ExpressionLanguage] Fix matching null against a regular expression
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
5.4.7
Description
In #45875 a behavior change was introduced.
How to reproduce
Previously the following code worked as expected:
Since version 5.4.7 this now throws a
TypeError: Symfony\Component\ExpressionLanguage\Node\BinaryNode::evaluateMatches(): Argument #2 ($str) must be of type string, null given
Possible Solution
If this is considered a bug or a BC break I’m happy to create a pull request to fix this (including a deprecation notice for non-string values I’d assume).
Additional Context
No response
The text was updated successfully, but these errors were encountered: