In FeedsNodeProcessor::setTargetElement(), $value is assumed to be of type string, but it could be an array, for instance, from multiple category elements in a feed item.

Thus, this results in warnings from multiple parts of Drupal core... only visible on the dblog, or if you have full error reporting enabled.

One way to fix this would be to just check for arrays and imploding into a string: (also, see patch)

   public function setTargetElement($target_node, $target_element, $value) {
     if (in_array($target_element, array('url', 'guid'))) {
       $target_node->feeds_node_item->$target_element = $value;
     }
     elseif ($target_element == 'body') {
+      if (is_array($value)) {
+        $value = implode(' ', $value);
+     }
       $target_node->teaser = node_teaser($value);
       $target_node->body = $value;
     }
     elseif (in_array($target_element, array('title', 'status', 'created', 'nid', 'uid'))) {
+      if (is_array($value)) {
+        $value = implode(' ', $value);
+      }
       $target_node->$target_element = $value;
     }
   }

This problem will also happen in FeedsFeedNodeProcessor::setTargetElement(), BTW.

CommentFileSizeAuthor
feeds.patch1.68 KBjanusman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

twistor’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)