Needs work
Project:
Drupal core
Version:
main
Component:
configuration entity system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Mar 2017 at 23:29 UTC
Updated:
9 Feb 2026 at 14:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
pwolanin commentedHere's an addition to the existing test to show a failure. The failure message basically shows that only the last sort applied matters. There's nothing in the interface the suggests that's the expected behavior as compared to a SQL query.
Comment #4
pwolanin commentedHere's with a recursive sorting function that should work for any number of sorts.
But wow - the tablesort behavior for config is weirdly broken also.
The current test assumes the added sort() call actually overrides the sort specified from the tablesort headers. With the fix, it will only add an additional sort on items that sort the same in the tablesort.
Comment #8
m4oliveiRan into another issue with the default sort wherein we expected it to sort ignoring case, but it doesn't do that, so an ASC sort on label returns:
Peach_Candor
Peach_Herald_Beauty
Peach_Red_Haven
Peach_loring
expected:
Peach_Candor
Peach_Herald_Beauty
Peach_loring
Peach_Red_Haven
Comment #10
dpolant commentedTo fix the issue m4olivei has described we'll need to use something other than the php comparator to sort the strings. strcasecomp() might work.
Comment #14
bklineJust as an aside, it seems that it would have been much less likely for this bug to have gotten this far if the
sort()method had actually had some real documentation, explaining that it can be invoked more than once for a query. That would have encouraged people to actually use that capability at the outset, and maybe some unit tests would have even been created from the start to verify that the array in which the sort fields were stored was used correctly.Comment #15
bklineWould it be possible to provide a pointer to that requirement? I don't doubt that it exists, but it's certainly not in the documentation for the
sort()method. Also, wouldn't this be a separate bug? If discovering this second bug has everyone so stumped that it has blocked fixing the original, more serious bug for over two years, perhaps applying the principle of one bug, one ticket might get this one moving again. Just a thought.Comment #22
larowlanComment #23
chrisdarke commentedMigrating Pittsburgh 2023 to Pittsburgh2023 tag for cleanup
Comment #24
prem suthar commentedI have added the Re-rolled patch for 11.x.
Comment #27
wim leersI just ran into this too for Canvas — quoting
\Drupal\canvas\Controller\ApiConfigControllers::list():… but due to the bug reported here, it is indeed impossible.
Illustrated:

👆 Note the 2 sorts correctly appear, after the first sort, the order is correct, but then just as we're about to execute the second sort, the original sort is overwritten.