Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Number formatted as % but it is not a percentage #9049

Closed
mattab opened this issue Oct 19, 2015 · 2 comments
Closed

Number formatted as % but it is not a percentage #9049

mattab opened this issue Oct 19, 2015 · 2 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Oct 19, 2015

can be seen @ http://demo-anonymous.piwik.org/index.php?module=CoreHome&action=index&idSite=1&period=year&date=today#?module=Events&action=index&idSite=1&period=year&date=today

The Total Event value is a numeric value. It is sometimes, formatted as %:

bug in number formatting

@mattab mattab added Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. labels Oct 19, 2015
@mattab mattab added this to the 2.15.0 milestone Oct 19, 2015
@mattab
Copy link
Member Author

mattab commented Oct 19, 2015

Hi @sgiehl maybe you could help / have an idea about this one?

@sgiehl
Copy link
Member

sgiehl commented Oct 19, 2015

Maybe that kind of a casting issue. Would you mind testing a small code change on demo? I'm not able to reproduce that locally:

https://github.com/piwik/piwik/blob/master/core/Twig.php#L304
Try to switch the both compared variables or try:
if ((string)$string != trim($string, '%')) {

@diosmosis diosmosis self-assigned this Oct 20, 2015
diosmosis added a commit that referenced this issue Oct 20, 2015
Fixes #9049, in NumberFormatter::format() check for percent if value is a string only, since only strings will have a % (avoids floating point issues).

Also includes some refactoring to NumberFormatter + its test.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

No branches or pull requests

3 participants