Last modified: 2012-03-20 16:32:50 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 T23054, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 21054 - formatnum breaks strip markers and wikilinks
formatnum breaks strip markers and wikilinks
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.16.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Tim Starling
http://en.wikipedia.org/w/api.php?act...
:
: 21178 (view as bug list)
Depends on:
Blocks: UNIQ
  Show dependency treegraph
 
Reported: 2009-10-08 13:00 UTC by Brad Jorsch
Modified: 2012-03-20 16:32 UTC (History)
3 users (show)

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


Attachments

Description Brad Jorsch 2009-10-08 13:00:17 UTC
This stems from a discussion at [[en:WP:VPT#Strange categories due to .7B.7Bfact.7D.7D tags]].

It seems from the code comments that the formatnum parser function is only supposed to apply to numeric input, but as written it will happily reformat any number anywhere in the text input. This easily mangles strip markers (see the URL above), and also causes issues if someone winds up with a wikilink in the formatnum input (e.g. "Category:Foo in 2009" becomes "Category:Foo in 2,009", possibly from something like "1234{{fact|date=April 2008}}" being passed into a template parameter that is formatnummed).

Possible fixes off the top of my head:
1. formatnum could insist on its input being numeric, and either return the input unchanged or return an error if not.
2. formatnum could pull off the leading numeric text, and return anything after the first non-numeric unaltered. E.g. "1234 foo bar 5678" => "1,234 foo bar 5678".
3. The documentation and comments could be updated to define this as the expected behavior.

In either the first or third cases, a workaround for the enwiki templates would be to supply both a numeric and a postscript parameter (e.g. instead of "{{infobox|pop=1234{{fact}}}}", it could be "{{infobox|pop=1234|pop ref={{fact}}}}").
Comment 1 Brion Vibber 2009-10-08 17:01:58 UTC
Scary parser internals... assigning to Tim. :)
Comment 2 Niklas Laxström 2009-10-08 17:07:42 UTC
I would go for at least 3., and 1. if possible.
Comment 3 P.Copp 2009-10-19 15:06:28 UTC
*** Bug 21178 has been marked as a duplicate of this bug. ***
Comment 4 Aryeh Gregor (not reading bugmail, please e-mail directly) 2010-03-09 19:10:35 UTC
I'd think (1) or (2) would break things, no?  Probably users are depending someplace on $1234.56 becoming $1,234.56, or who knows what.
Comment 5 Tim Starling 2012-03-20 04:42:32 UTC
I fixed the strip tag breakage in r114231. I don't think formatnum should skip links, so I'm marking the bug fixed on the basis that what can be done here has been done.

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


Navigation
Links