Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.65
diff -d -u -r1.65 includes/path.inc
--- includes/path.inc	16 Jul 2010 02:51:44 -0000	1.65
+++ includes/path.inc	17 Jul 2010 06:25:33 -0000
@@ -127,23 +127,26 @@
     // isn't a path that has this alias
     elseif ($action == 'source' && !isset($cache['no_source'][$path_language][$path])) {
       // Look for the value $path within the cached $map
-      if (!isset($cache['map'][$path_language]) || !($source = array_search($path, $cache['map'][$path_language]))) {
-        // Get the most fitting result falling back with alias without language
-        if ($source = db_query("SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, :language_none) ORDER BY language DESC, pid DESC", array(
-                     ':alias' => $path,
-                     ':language' => $path_language,
-                     ':language_none' => LANGUAGE_NONE))
-            ->fetchField()) {
-          $cache['map'][$path_language][$source] = $path;
+      if (isset($cache['map'][$path_language])) {
+        $source = array_search($path, $cache['map'][$path_language]);
+        if ($source) {
           return $source;
         }
-        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_source.
-          $cache['no_source'][$path_language][$path] = TRUE;
-        }
       }
+      // Get the most fitting result falling back with alias without language
+      $source = db_query("SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, :language_none) ORDER BY language DESC, pid DESC", array(
+                   ':alias' => $path,
+                   ':language' => $path_language,
+                   ':language_none' => LANGUAGE_NONE))
+          ->fetchField();
+      if ($source) {
+        $cache['map'][$path_language][$source] = $path;
+        return $source;
+      }
+      // 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_source.
+      $cache['no_source'][$path_language][$path] = TRUE;
     }
   }
 
