The module did not cooperate with internationalization module.

  if (module_exists('i18n')) {
    if ($path = drupal_get_normal_path($matches[3])) {
      if (substr($path, 0, 5) == 'node/') {
        $nid = substr($path, 5);
      }
    }
    elseif (preg_match('/(node\/([0-9]+))$/', $matches[3], $match)) {
      $nid = $match[2];
    }
    if (!empty($nid)) {
      $languages = language_list('enabled');
      $languages = $languages[1];
      if (isset($language)) { $url_array['language'] = $languages[i18n_node_get_lang($match[2])];}
      $link = url($match[1], $url_array);
    }
  }

If the first condition passed properly (via drupal_get_normal_path) the second part of the function did not trigger and I got some errors. I changed the function not to use the $match variable and use directly the discovered $nid with "node" prefix.

Also the function i18n_node_get_lang in the latest i18n version uses an obsolete function and results in WSOD with an error. The proper patch is here: #1144914: Node get language cannot use db_result() function.

This thread was created as a follow-up of the thread #945512: Drupal 7 port.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tarmstrong’s picture

The above patch fails if the node corresponding to $nid does not exist. I get this error message:

Notice: Undefined index: in _pathfilter_process_internal() (line 129

Here is a patch that does not rely on the node existing.