[5.x] Fix ordering nulls before non-nulls#11976
Conversation
|
The single failing test test_parser_isolation_considers_all_options_after_taxonomy was failing due to the assumption of entry order when a title is empty. Previously, when the title was empty the default (sorting title by ascending) would put the nulls would be at the end; now they are at the beginning since they are considered a lesser value |
This is doing The null sorting behavior should match However I have a simple fix that I can push separately. Toggle fields should get indexed as booleans, not nulls. Then when you query you will only be dealing with true and false. |
When adding fields to an existing blueprint, the newly created fields will have a value of null. When ordering by the newly created field you'd expect those without values would be placed after those with values. This PR changes the comparison between nulls and non-nulls so that nulls are placed after non-nulls.
I realize this is a large change in that it could affect a lot, but I believe the way this functions now is not desired or expected behavior.
Example where this matters:
Also in favor of this change, if you create an array in PHP and sort it you get the expected orders - with null coming after non-null: