Don’t unlocalize month names without letters - #167
Open
lucaswerkmeister wants to merge 1 commit into
Open
Conversation
The case of purely-numeric month names (ko) is already handled, because PHP implicitly turns such array keys into integers, and then they fail the existing is_string() check. But MonthNameUnlocalizer would still unlocalize month names that only consisted of numbers and punctuation (cs), which isn’t right either; add another check to prevent that. Bug: T325988
| @@ -46,6 +46,10 @@ public function unlocalize( $date ) { | |||
| if ( !is_string( $search ) ) { | |||
Contributor
There was a problem hiding this comment.
This check is now redundant, isn't it? The key is either a string or an integer (that cannot be matched with the regex).
Member
Author
There was a problem hiding this comment.
I guess we could remove it and use (string)$search below, but to me that seems less clear (and probably also slightly slower). I’d prefer to keep the separate condition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The case of purely-numeric month names (ko) is already handled, because PHP implicitly turns such array keys into integers, and then they fail the existing
is_string()check. ButMonthNameUnlocalizerwould still unlocalize month names that only consisted of numbers and punctuation (cs), which isn’t right either; add another check to prevent that.Bug: T325988