Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Path%21Al...
Enter a descriptive title (above) relating to public function AliasStorage::aliasExists, then describe the problem you have found:
Return value
bool TRUE if alias already exists and FALSE otherwise.
This is not true because the code specifically checks for NOT LIKE $source.
if (!empty($source)) {
$query->condition('source', $this->connection->escapeLike($source), 'NOT LIKE');
}
Personally I think that it should check for the source as we can't check if an alias exists for a given source at the moment.
Kind regards,
Thomas Dik
Comment | File | Size | Author |
---|---|---|---|
#2 | aliasexists_with_a-2843002-2.patch | 1.8 KB | Anonymous (not verified) |
#2 | aliasexists_with_a-2843002-2-test-only.patch | 1.12 KB | Anonymous (not verified) |
Comments
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedWe should adjust the code, not the documentation.
Comment #4
jnicola CreditAttribution: jnicola commentedI ran into this same issue just today, and resolved it the same way that you did. So I can attest that switching from NOT LIKE to LIKE resolves the situation.
Comment #8
hash6 CreditAttribution: hash6 commentedI also found an issue while creating new content, it did not check the existing aliases if langcode was set to null and was able to fix it by adding an if condition on $langcode
Comment #15
quietone CreditAttribution: quietone at PreviousNext commentedThanks to everyone who worked on this.
The work here relates to a change that was removed in Drupal 9.0.0 #3092090: Remove legacy Path Alias subsystem and there does not seem to be a direct replacement.
Therefore, closing as outdated.
Thanks!