Drupal: warning: Illegal offset type in /var/www/html/avocado/modules/taxonomy/taxonomy.module on line 1150.



This error in Drupal was buging me for some time when using leach module in drupal:

* warning: Illegal offset type in isset or empty in /home/webadmin/mytroops.com/html/drupal/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /home/webadmin/mytroops.com/html/drupal/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /home/webadmin/mytroops.com/html/drupal/modules/taxonomy/taxonomy.module on line 1154.
* : Object of class stdClass could not be converted to string in /home/webadmin/mytroops.com/html/drupal/sites/all/modules/pathauto/pathauto_node.inc on line 223.
* warning: Illegal offset type in isset or empty in /home/webadmin/mytroops.com/html/drupal/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /home/webadmin/mytroops.com/html/drupal/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /home/webadmin/mytroops.com/html/drupal/modules/taxonomy/taxonomy.module on line 1154.

In the end, I found the following patch to work:

 

--- pathauto_node.inc.orig      2007-04-29 00:30:14.839833000 -0500
+++ pathauto_node.inc 2007-04-29 00:30:19.876147750 -0500
@@ -211,6 +211,9 @@ function node_get_placeholders($node) {
break;
}
}
+ if(is_object($first_term_id)) {
+ $first_term_id=$first_term_id->tid;
+ }
$term = taxonomy_get_term($first_term_id);

$placeholders[t('[cat]')] = pathauto_cleanstring($term->name);

 


 This means simply add:

 

    if(is_object($first_term_id)) {
$first_term_id=$first_term_id->tid;
}
before line 221 that should be:  $term = taxonomy_get_term($first_term_id);
in pathauto_node.inc  

 

 

 

 


COMMENTS