Problem/Motivation

\Drupal\path_alias\AliasPrefixList does lookups in a case-sensitive fashion but paths in Drupal are not case sensitive. This means the if node/1 is aliased to node_one when you do a lookup for NODE/1 with the path alias manager it will not find the alias but it will if you \Drupal\path_alias\AliasRepositoryInterface::lookupBySystemPath(),

Steps to reproduce

Proposed resolution

Make AliasPrefixList case insenstive.
Make AliasRepository::preloadPathAlias() return an entry the path stored in the path alias table and a matching path (if they differ).

Remaining tasks

User interface changes

Introduced terminology

N/a

API changes

Data model changes

Release notes snippet

Issue fork drupal-3567544

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Version: 11.3.x-dev » 11.x-dev
catch’s picture

Status: Active » Needs work

Once comment on the MR, and could probably use test coverage, but otherwise makes sense.

alexpott’s picture

Status: Needs work » Needs review

Added test coverage, addressed comment and made further changes to ensure the path alias manager is actually case insensitive.

alexpott’s picture

Title: Alias lookup by path is not case sensitive but AliasPrefixList is leading to inconsistencies » Alias lookup by path is not case sensitive but AliasPrefixList and AliasRepository::preloadPathAlias's return value is leading to inconsistencies
Issue summary: View changes
godotislate’s picture

A couple test failures that look unrelated.

One question on the MR about the test assertion custom messages. I think the general suggestion from #3131946: [policy] Remove PHPUnit assertion messages when possible, and standardize remaining messages is not to use them, but not sure if that's final or if there are exceptions.

godotislate’s picture

Status: Needs review » Reviewed & tested by the community

I rebased to get the validatable config job passing, and this LGTM after response about the assertion messages.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Doesn't apply following #3567086: Alias case sensitivity after the removal of the preload cache

Also instead of adding to the baseline should we just add return types here to the new methods? Or is there concern that AliasPrefixList has been extended somewhere and these methods are already overridden?

alexpott’s picture

Status: Needs work » Reviewed & tested by the community

Merged in main - there we no conflicts to resolve.

I chose to add to the baseline after recent issues where we added typehints to things like this and broke projects and contributed modules. Just seems safer.

  • longwave committed 66b5b396 on 11.x
    fix: #3567544 Alias lookup by path is not case sensitive but...

  • longwave committed cd54e644 on main
    fix: #3567544 Alias lookup by path is not case sensitive but...
longwave’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed cd54e644bde to main and 66b5b396b0e to 11.x. Thanks!

Decided not to backport this one as it's a minor behaviour change, let's leave this for 11.4.0.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.