-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files #24594
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
[Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files #24594
Conversation
| preg_match_all('/(?:\|\||[^\|])++/', $message, $parts); | ||
| $parts = array(); | ||
| if (preg_match('/^\|+$/', $message)) { | ||
| $parts = explode('|', $message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is broken if previous parts of the message have escaped pipes in them
| { | ||
| preg_match_all('/(?:\|\||[^\|])++/', $message, $parts); | ||
| $parts = array(); | ||
| if (preg_match('/^\|+$/', $message)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change the regex to ^\|++$ to avoid useless backtracking (which could cause issues with long strings). Backtracking will never allow to find a match in a different way for this regex.
Sorry, something went wrong.
All reactions
|
@stof , changes made as requested :) |
All reactions
Sorry, something went wrong.
|
But tests are failing. |
All reactions
Sorry, something went wrong.
…translated plural forms from .po files
|
@nicolas-grekas I've rebased the branch on 3.3 and all tests pass now. I think there were some failing tests in the 3.2 branch |
All reactions
Sorry, something went wrong.
|
@nicolas-grekas @stof tests are passing, is this okay to merge now? |
All reactions
Sorry, something went wrong.
|
This has been rebased on 3.3 and tests are passing. Can this be merged please? |
All reactions
Sorry, something went wrong.
|
Are 2.7 and 2.8 not affected? |
All reactions
Sorry, something went wrong.
|
Thank you @BjornTwachtmann. |
All reactions
Sorry, something went wrong.
…anslated plural forms from .po files (BjornTwachtmann) This PR was squashed before being merged into the 3.3 branch (closes #24594). Discussion ---------- [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files | Q | A | ------------- | --- | Branch? | 3.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24593 | License | MIT This PR fixes the bug in #24593. It's not the absolutely ideal way to address the issue, but I don't see how else to handle it without either dropping support for pips in translation strings, or rearchitecting the code that feeds translations to the MessageSelector as pipe separated in the first place. Commits ------- fea815b [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files
Reviewers
stof
fabpot
+1 more reviewer
Tasiobg
Assignees
No one assignedLabels
Projects
Milestone
3.3Development
Successfully merging this pull request may close these issues.
This PR fixes the bug in #24593. It's not the absolutely ideal way to address the issue, but I don't see how else to handle it without either dropping support for pips in translation strings, or rearchitecting the code that feeds translations to the MessageSelector as pipe separated in the first place.