Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ExpressionLanguage] Fix matches when the regexp is not valid#45875

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.4fromfabpot:expression-language-matches-fix
Mar 30, 2022

Conversation

@fabpot
Copy link
Member

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
Ticketsn/a
LicenseMIT
Doc PRn/a

@fabpotfabpotforce-pushed theexpression-language-matches-fix branch from22f81a7 tob2da2f8CompareMarch 30, 2022 10:36
@fabpotfabpotforce-pushed theexpression-language-matches-fix branch fromb2da2f8 tof09da16CompareMarch 30, 2022 11:46
@fabpotfabpot merged commit7dc98de intosymfony:4.4Mar 30, 2022
@fabpotfabpot deleted the expression-language-matches-fix branchMarch 30, 2022 14:40
This was referencedApr 2, 2022
fabpot added a commit that referenced this pull requestApr 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#45875Commits-------3326da0 [ExpressionLanguage] Fix matching null against a regular expression
fabpot added a commit that referenced this pull requestOct 6, 2024
…g used as regexp (ivantsepp)This PR was squashed before being merged into the 7.2 branch.Discussion----------[ExpressionLanguage] Fix matches to handle booleans being used as regexp| Q             | A| ------------- | ---| Branch?       | 7.2| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        | n/a| License       | MITI'm marking this as a bug fix but this could be seen as a "new feature" as existing `matches` syntax functionality works just fine.I wanted to build on top of the work done at#45875. This handles invalid regular expressions and also does an extra check inside the `compile` method. It checks the right hand side for a `ConstantNode` and validates that it's a valid regexp. The idea is that we can go **even further** and check for `BinaryNode` because in most cases, this is an invalid regexp since a boolean usually returned. The exception is `~` which is for string concatenation since that could result in a valid regexp.This extra check could help prevent invalid expressions like `"a" matches ("/a/" || "/b/")` where one could mistake `"/a/" || "/b/"` as being a valid regexp (when the correct approach would've been `"a" matches "/a|b/"`)Commits-------e0fbc7e [ExpressionLanguage] Fix matches to handle booleans being used as regexp
symfony-splitter pushed a commit to symfony/expression-language that referenced this pull requestOct 6, 2024
…g used as regexp (ivantsepp)This PR was squashed before being merged into the 7.2 branch.Discussion----------[ExpressionLanguage] Fix matches to handle booleans being used as regexp| Q             | A| ------------- | ---| Branch?       | 7.2| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        | n/a| License       | MITI'm marking this as a bug fix but this could be seen as a "new feature" as existing `matches` syntax functionality works just fine.I wanted to build on top of the work done atsymfony/symfony#45875. This handles invalid regular expressions and also does an extra check inside the `compile` method. It checks the right hand side for a `ConstantNode` and validates that it's a valid regexp. The idea is that we can go **even further** and check for `BinaryNode` because in most cases, this is an invalid regexp since a boolean usually returned. The exception is `~` which is for string concatenation since that could result in a valid regexp.This extra check could help prevent invalid expressions like `"a" matches ("/a/" || "/b/")` where one could mistake `"/a/" || "/b/"` as being a valid regexp (when the correct approach would've been `"a" matches "/a|b/"`)Commits-------e0fbc7ee02 [ExpressionLanguage] Fix matches to handle booleans being used as regexp
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

3 participants

@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp