Verified Commit b14885a7 authored by Juraj Nemec's avatar Juraj Nemec
Browse files

Issue #1160764 by ianthomas_uk, Désiré, poker10, Dave Reid, SebCorbin,...

Issue #1160764 by ianthomas_uk, Désiré, poker10, Dave Reid, SebCorbin, agentrickard: URL alias load is inconsistent if there are more then one alias
parent e8872374
Loading
Loading
Loading
Loading
+2 −0
Changes for includes/path.inc: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -417,6 +417,8 @@ function path_load($conditions) {
  }
  return $select
    ->fields('url_alias')
    ->orderBy('pid', 'DESC')
    ->range(0, 1)
    ->execute()
    ->fetchAssoc();
}
+11 −0
Changes for modules/simpletest/tests/path.test: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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.');
  }
}