There is a bug in node_feed namespace handling in that if your custom module returns namespace information you end up with duplicate entries for that namespace in the final xml output because of how array_merge works on the $namespace array.

From the php manual

 array array_merge  ( array $array1  [, array $array2  [, array $...  ]] )

Merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.

If the input arrays have the same string keys, then the later value for that key will overwrite the previous one. If, however, the arrays contain numeric keys, the later value will not overwrite the original value, but will be appended. 

Since $namespace does not use string keys the end array will have duplicate entries for all 'rss item' invokes that return the same namespace information. The resulting xml does not validate.

function node_feed($nodes = 0, $channel = array()) {
  // code snipped

  $namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"');

  // code snipped

    // Allow modules to add additional item fields and/or modify $item
    $extra = node_invoke_nodeapi($item, 'rss item');
    $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => gmdate('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid .' at '. $base_url, 'attributes' => array('isPermaLink' => 'false'))));
    foreach ($extra as $element) {
      if ($element['namespace']) {
        $namespaces = array_merge($namespaces, $element['namespace']);
      }
    }

  //code snipped
  $output .= "<rss version=\"". $channel["version"] ."\" xml:base=\"". $base_url ."\" ". implode(' ', $namespaces) .">\n";

This should be easy to fix by converting $namespace to a keyed array so that duplicates are not merged in and then change the one line that outputs the code as needed. I will work up a patch for this and submit ASAP.

Comments

dldege’s picture

Version: 6.6 » 5.12

Darn, I see this is already fixed in drupal 6 so just a backport to d5 would be required.

dldege’s picture

Are fixes of this nature being considered for subsequent point releases of D5???

dpearcefl’s picture

Status: Active » Closed (won't fix)

Considering the time elapsed between now and the last comment plus the fact that D5 is no longer supported, I am closing this ticket.