Fatal error: Unsupported operand types

Sheldon Rampton - July 4, 2007 - 22:47
Project:Yahoo Terms
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:designerbrent
Status:needs review
Description

I'm getting the following error message when I try to refresh a Leech feed:

Fatal error: Unsupported operand types in /usr/www/users/dpedia/drupal5/sites/all/modules/yahoo_terms/yahoo_terms.module on line 123

The path that generates this error message is:

leech/refresh/45?destination=leech/feed

The code that generates this error is as follows (beginning with line 118):

  $tids = _yahoo_terms_create_vocabulary_items($terms, $vid, $static);
  $tids_in_node = array_keys($node->taxonomy);
  $tids_fetched = array_keys($tids);
  // Union of these arrays
  $tids_now = $tids_in_node + $tids_fetched;
  taxonomy_node_save($node->nid, $tids_now);

I checked the variable table in my database, and it has a value of "4" (the numeric ID for my "keywords" vocabulary) for yahoo_terms_vocab, yahoo_terms_vocab_for_rssfeed (rssfeed is the content type for my feed items) and yahoo_terms_vocab_for_rsssource (the content type for my feed sources). I inserted a line into the module just above the lines above to set $vid = 4, and the error message disappeared. It appears, therefore, that the $vid is not getting passed into this function properly. I believe the place where this is happening is line 2364 of the leech module, which reads,

      node_invoke_nodeapi($edit, "terms_tagging", $vid, $query);

If I add a "$vid=4" just above the node_invoke_nodeapi command, the fatal error disappears, but some other strange things are happening. When I click on "retrieve feed items" for one of my feed sources, items get loaded and nodes get created, but the items don't show up when I click "view feed items." However, they do show up as items under taxonomy/term/1, which is strange, because taxonomy/term/1 is a term in my "topics" vocabulary, not the "keywords" vocabulary which I am trying to use with leech/yahoo_terms.

#1

marcoBauli - November 13, 2007 - 23:48

Getting the same error, but when posting any content type (page, story, CCK) different from the Leech template type (I installed Yahoo_terms to be used with Leech actually)..pretty critical, as no other contents can be posted to the site..

Drupal 5.3 and latest Yahoo_terms here. Thx

#2

mdekkers - November 28, 2007 - 12:41

Same here....

#3

designerbrent - April 21, 2008 - 12:56
Assigned to:Anonymous» designerbrent
Status:active» needs review

This seems to fix the problem. I haven't tested it on the 5.x version, only on the patch I am working on for drupal 6.

I was able to reproduce the bug when creating new nodes. It seems that the $node->taxonomy was null and that was causing the error when it was trying to join with the $tids_fetched to create $tids_now.

This patch checks if $node->taxonomy is null and if so, then works without it.

AttachmentSize
yahooterms5.patch 983 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.