getkirby-v2 / panel

This is the deprecated admin panel for Kirby v2.
http://getkirby.com
Other
134 stars 70 forks source link

Page reordering broken in 2.5.9 #1138

Closed texnixe closed 6 years ago

texnixe commented 6 years ago

https://forum.getkirby.com/t/kirby-2-5-9-panel-page-re-ordering-broken/9868

Looks like this happens as soon as you add a tenth visible child, with 9 children, seems to be ok.

HashandSalt commented 6 years ago

Seems it happens even if you re-order the pages manually in the filesystem (ie with finder) and go back into the panel. I think i edited and saved one article in the panel after manually ordering and it reshuffled all the pages out of order again.

texnixe commented 6 years ago

Seems to happen with image sorting as well 😱:

https://forum.getkirby.com/t/manual-sorting-images-problem-with-kirby-2-5-9/9876

lukasbestle commented 6 years ago

Oh no. :( I will take a look at this very soon.

texnixe commented 6 years ago

This is not really a panel issue, but caused by changes in the toolkit, as far as I can see by changes in the collection class, if I roll back those changes, the error is gone.

https://github.com/getkirby/toolkit/commit/838a94c5c6d02f1b9b5cf24a96ae937b08e64603

Foddy commented 6 years ago

Any news regarding this issue?

lukasbestle commented 6 years ago

It was indeed the refactored $collection->sortBy() method. To fix sorting of strings with international characters like German Umlauts, I had implemented locale-based sorting. But it turns out that locale-based sorting (in contrast to regular sorting) doesn't respect the order of numbers. 10 was right behind 1, not behind 9. That of course broke everything.

This is one reason why I sometimes hate PHP. Logically the behavior should be exactly the opposite, but "regular sorting" is the more robust solution, so I have changed the default back. However it is still possible to pass custom flags if you need locale sorting for a specific use-case.

So end of the story: Fixed on the develop branch of the Toolkit for the next release. You can change the one line in your installation to get the fix already now.