Skip to content
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

Don’t unlocalize month names without letters #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucaswerkmeister
Copy link
Member

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

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 ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is now redundant, isn't it? The key is either a string or an integer (that cannot be matched with the regex).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's keep it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants