Issue #1160764 by ianthomas_uk, Désiré, poker10, Dave Reid, SebCorbin, agentrickard: URL alias load is inconsistent if there are more then one alias

merge-requests/3045/head
Juraj Nemec 2022-09-03 16:19:46 +02:00
parent e8872374e8
commit b14885a783
No known key found for this signature in database
GPG Key ID: 01EC3E1EECB5B2CA
2 changed files with 13 additions and 0 deletions

View File

@ -417,6 +417,8 @@ function path_load($conditions) {
}
return $select
->fields('url_alias')
->orderBy('pid', 'DESC')
->range(0, 1)
->execute()
->fetchAssoc();
}

View File

@ -331,6 +331,17 @@ class PathLookupTest extends DrupalWebTestCase {
);
path_save($path);
$this->assertEqual(drupal_lookup_path('source', $path['alias']), $path['source'], 'Newer alias record is returned when comparing two LANGUAGE_NONE paths with the same alias.');
// Test if the alias returned by drupal_lookup_path() is the same as the
// alias returned by path_load().
$path = array(
'source' => 'user/' . $account2->uid,
'alias' => 'bar2',
);
path_save($path);
$this->assertEqual(drupal_lookup_path('alias', $path['source']), 'bar2', 'Newer alias record is returned when using drupal_lookup_path() on paths with multiple aliases.');
$loaded_path = path_load(array('source' => $path['source']));
$this->assertEqual($loaded_path['alias'], 'bar2', 'Newer alias record is returned when using path_load() on paths with multiple aliases.');
}
}