--- includes/path.inc 2010-05-28 08:12:04.000000000 -0700 +++ includes/path.inc 2010-07-16 23:28:31.000000000 -0700 @@ -74,20 +74,22 @@ // isn't a path that has this alias elseif ($action == 'source' && !isset($no_src[$path_language][$path])) { // Look for the value $path within the cached $map - $src = ''; - if (!isset($map[$path_language]) || !($src = array_search($path, $map[$path_language]))) { - // Get the most fitting result falling back with alias without language - if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', '') ORDER BY language DESC, pid DESC", $path, $path_language))) { - $map[$path_language][$src] = $path; - } - else { - // We can't record anything into $map because we do not have a valid - // index and there is no need because we have not learned anything - // about any Drupal path. Thus cache to $no_src. - $no_src[$path_language][$path] = TRUE; + if (isset($map[$path_language])) { + $src = array_search($path, $map[$path_language]); + if ($src) { + return $src; } } - return $src; + // Get the most fitting result falling back with alias without language + $src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', '') ORDER BY language DESC, pid DESC", $path, $path_language)); + if ($src) { + $map[$path_language][$src] = $path; + return $src; + } + // We can't record anything into $map because we do not have a valid + // index and there is no need because we have not learned anything + // about any Drupal path. Thus cache to $no_src. + $no_src[$path_language][$path] = TRUE; } }