Query results are case sensitive when sorting alphabetically

Created on 14 January 2025, 7 days ago

Problem/Motivation

Perhaps not widely encountered, but I came across a potentially unexpected sorting outcome for Entity query builder when testing patches for the menu list builder (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. Create enough new menus to force pagination (50+)
  2. Ensure that menu entries are a mix of capital and lowercase labels

As soon as pagination is triggered, one should start to see unexpected groupings of lowercase labels on the subsequent page.

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

🐛 Bug report
Status

Active

Version

10.2

Component

entity system

Created by

🇨🇦Canada tdroden Calgary, Alberta

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024