Last modified: 2013-02-13 12:49:12 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 T46451, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 44451 - Extension:Sort doesn't handle negative numbers well; maybe it needs a special "numeric mode"
Extension:Sort doesn't handle negative numbers well; maybe it needs a special...
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Sort (Other open bugs)
master
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-29 01:21 UTC by Jason Spiro
Modified: 2013-02-13 12:49 UTC (History)
1 user (show)

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


Attachments

Description Jason Spiro 2013-01-29 01:21:10 UTC
Thank you for writing Extension:Sort.  It sorts "See also" lists fine, which was a use case I had in mind.

Andre Klapper is unhappy[*] sorts negative numbers incorrectly.  I don't know why he's concerned about numeric sorting, but I am reporting his concern anyway.

Here are some more details:  The extension sorts negative numbers incorrectly because it uses PHP's natsort() "natural" sorting function, which also sorts negative numbers incorrectly.[**]  For example:[**]  natsort(7, 12, -13, 2, 100, 5, 1, -2, 23, 3, 6, 4) returns [ -2, -13, 1, 2, 3, 4, 5, 6, 7, 12, 23, 100 ].

Andre would like you to modify the extension to include a mode for sorting lists composed of both positive and negative numbers.  Perhaps this mode could use sort() or asort() instead.[**]

By the way, Andre, why do you want numeric sorting?

^  [*].   https://bugzilla.wikimedia.org/show_bug.cgi?id=9396#c15
^  [**].  http://pleac.sourceforge.net/pleac_php/arrays.html#AEN212

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


Navigation
Links