Last modified: 2014-04-17 10:32:05 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T65977, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63977 - formatnum does not handle numbers between -1 and 0 for languages with $digitGroupingPattern (also malforms string input)
formatnum does not handle numbers between -1 and 0 for languages with $digitG...
Status: UNCONFIRMED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.23.0
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-15 23:16 UTC by gnosygnu
Modified: 2014-04-17 10:32 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description gnosygnu 2014-04-15 23:16:05 UTC
== REPRODUCTION #1 ==
* Navigate to https://hi.wikipedia.org/w/index.php?title=Project:Sandbox&action=submit
* Enter in the following wikitext: {{formatnum:-.123}}
* Preview the wikitext. The following is produced: "-.1.123"
* Compare this to https://en.wikipedia.org/w/index.php?title=Project:Sandbox&action=submit wherein {{formatnum:-.123}} generates "-.123"

== REPRODUCTION #2 ==
* Similar to above, but enter in the following wikitext: {{formatnum:a123}}
* On hi.wikipedia.org, it produces "a12"
* On en.wikipedia.org, it produces "a123"

== DETAILS ==
* The issue only affects languages which have the $digitGroupingPattern specified
- MessagesAs.php
- MessagesBn.php
- MessagesGu.php
- MessagesHi.php
- MessagesKn.php
- MessagesMl.php
- MessagesMr.php
- MessagesOr.php
- MessagesPa.php
- MessagesSa.php
- MessagesTa.php
- MessagesTe.php
* The problem is in the commafy function in languages\Language.php 
* The lack of $digitGroupingPattern causes the function to enter the 2nd if branch which produces the bad output
* Note that most languages don't specify $digitGroupingPattern (such as en)

== OTHER ==
* Note the following extreme outlier: {{formatnum:1234a5678b2345c.3456d7890e3210.f5432}}
* On hi.wikipedia.org, it produces "1,234.3456"
** commafy branch #2 takes the first "number" group, and then concatenates the first "decimal" group
* On en.wikipedia.org, it produces "1,234a5,678b2,345c.3456d7,890e3,210.f5,432"
** commafy branch #1 goes through the entire string and formats non-decimal numbers
* In theory both results should be consistent
Comment 1 gnosygnu 2014-04-15 23:26:20 UTC
Slight correction to the above: "The lack of $digitGroupingPattern" should be "The presence of $digitGroupingPattern"

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links