Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
feeds.patch | 1.68 KB | janusman | |
Comments
Comment #1
twistor CreditAttribution: twistor as a volunteer commented