Page MenuHomePhabricator

Extension:Sort doesn't handle negative numbers well; maybe it needs a special "numeric mode"
Closed, DeclinedPublic

Description

Author: jasonspiro4

Description:
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


Version: master
Severity: enhancement

Details

Reference
bz44451

Related Objects

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:19 AM
bzimport set Reference to bz44451.
bzimport added a subscriber: Unknown Object (MLST).
MarcoAurelio closed this task as Declined.May 15 2018, 10:17 AM
MarcoAurelio edited subscribers, added: MarcoAurelio; removed: wikibugs-l-list.

Extension being archived at T194727.