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

Allow negative numbers being passed to transChoice #85

Closed
wants to merge 2 commits into from
Closed

Allow negative numbers being passed to transChoice #85

wants to merge 2 commits into from

Conversation

wodCZ
Copy link
Contributor

@wodCZ wodCZ commented Aug 26, 2015

No description provided.

@@ -143,7 +143,7 @@ public function translate($message, $count = NULL, $parameters = array(), $domai
$parameters = $tmp;

if ($count !== NULL && is_scalar($count)) {
return $this->transChoice($message, preg_replace('~[^0-9,.]~', '', $count), $parameters + array('%count%' => $count), $domain, $locale);
return $this->transChoice($message, preg_replace('~[^0-9,.\-]~', '', $count), $parameters + array('%count%' => $count), $domain, $locale);
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to allow the - only on the beginning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why is this needed anyway. The only next usage is here, casting value to integer and thanks to previous line in this file we can be sure that typecasting will never fail.
To be honest, this was only hotfix so I could continue in work, so I did not think about this very much :)

So:

  • if this is not needed, should I update PR with preg_replace removed?
  • if this is needed, would you please point me why & how to update PR to make this OK?

Thank you for your time!

Copy link
Member

Choose a reason for hiding this comment

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

I see! I overlooked that. I don't really remember why was the preg_replace needed. It can probably be removed.

@fprochazka
Copy link
Member

Thank you!

@wodCZ
Copy link
Contributor Author

wodCZ commented Aug 28, 2015

Thank You for merge!

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

Successfully merging this pull request may close these issues.

2 participants