﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
21180,Customize feature settings/controls sorting issue,wpcanyon,,"If you have up to 5 settings the sorting is fine. As soon as you go over 5 the sorting goes crazy. 

If there are 6 then the 1st and 2nd switch places, if you have 7 then 6th and 7th switch places, if you have 8 then the 1st and 2nd (the new ones, after the first switch) switch places.

So with 8 controls the sorting becomes: 3, 2, 1, 4, 5, 7, 6, 8

After digging around for a while, i found where this sorting mess up is coming from.

In class-wp-customize-manager.php on line 673...

{{{
usort( $section->controls, array( $this, '_cmp_priority' ) );
}}}

...it seems the controls are being sorted by priority, but they don't have priorities (from what i know). By removing this line the order is restored, but it's reversed (the controls are reversed on line 652), so adding this line...

{{{
$section->controls = array_reverse( $section->controls);
}}}

...the order is reversed again (becomes original) and the issue completely goes away.

I'm sure there's a reason for the sorting by priority so probably everything i just said is useless but at least you know there's a bug.",defect (bug),closed,normal,,Appearance,3.4.1,major,duplicate,close,
