Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299695

Query results are case sensitive when sorting alphabetically

$
0
0

Problem/Motivation

I came across a potentially unexpected sorting outcome for Entity query builder when testing patches for the menu list builder on Drupal 10.2.12 (see related issues).

Sorted results of execute() function of Drupal/Core/Config/Entity/Query/Query.php are case sensitive. This result may be mitigated by additional alphabetization later on via display. However, when pagination gets activated, due to the result chunking, lowercase entries can end up being grouped together and not displayed where one would expect them.

Steps to reproduce

  1. Fresh install of standard Drupal 10/11
  2. Install of Devel module - enable it and Devel Generate
  3. Using Devel Generate, create 50 new menus to force pagination of menu list (number of links and other settings per menu do not matter)
  4. Visit the menu list page (/admin/structure/menu).
  5. Devel Generate will have created a bunch of uppercase titled menus and the menu list will sort alphabetically as expected
  6. Manually create a new menu item called 'aardvark' (all lowercase) and save. Revisit the menu list page.
  7. The 'aardvark' menu should appear on the top of the second page of results, not sorted with the rest of the 'A' items on the first page.
  8. Manually create additional new menu items called 'echidna' and 'ocelot' (again, all lowercase) and save. Revisit the menu list page.
  9. The 'echidna' and 'ocelot' menu should appear on the top of the second page of results, grouped with 'aardvark' and not alphabetically sorted as expected.

Non-alphabetical menu list sorting

Proposed resolution

Use strcasecmp() when comparing strings.

Remaining tasks

Test
Review
Commit

User interface changes

None

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

TBD


Viewing all articles
Browse latest Browse all 299695

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>