https://bugzilla.wikimedia.org/show_bug.cgi?id=63977

            Bug ID: 63977
           Summary: formatnum does not handle numbers between -1 and 0 for
                    languages with $digitGroupingPattern (also malforms
                    string input)
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Unprioritized
         Component: Parser
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: gnosy...@gmail.com
       Web browser: ---
   Mobile Platform: ---

== 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

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to