I have installed pathauto dated November 12, 2006 - 10:56 into drupal 5beta1

I have a flex taxonomy defined for blog nodes. I made a blog posting and it gives me these messages:

    * warning: Illegal offset type in /var/www/vhosts/visforvoltage.org/httpdocs/modules/taxonomy/taxonomy.module on line 1087.
    * warning: Illegal offset type in /var/www/vhosts/visforvoltage.org/httpdocs/modules/taxonomy/taxonomy.module on line 1088.
    * warning: Illegal offset type in /var/www/vhosts/visforvoltage.org/httpdocs/modules/taxonomy/taxonomy.module on line 1091.
    * warning: Illegal offset type in /var/www/vhosts/visforvoltage.org/httpdocs/modules/taxonomy/taxonomy.module on line 1087.
    * warning: Illegal offset type in /var/www/vhosts/visforvoltage.org/httpdocs/modules/taxonomy/taxonomy.module on line 1088.
    * warning: Illegal offset type in /var/www/vhosts/visforvoltage.org/httpdocs/modules/taxonomy/taxonomy.module on line 1091.

The relavent code maps here:

function taxonomy_get_term($tid) {
  static $terms = array();

  if (!isset($terms[$tid])) { // line 1087
    $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
  }

  return $terms[$tid];
}

Scratching my head a little bit I added this line of code

  if (!in_array($tid, $terms)) return "";

And the error messages went away. Clearly $tid is not in $terms.

Comments

cog.rusty’s picture

Hmm... isn't $terms an array of database objects. Why should it contain $tid?
I don't understand php, so ignore it if it off mark.

pwolanin’s picture

I would guess this is a problem with pathauto not taxonomy- $tid should be an integer- maybe put some debugging code in like:


function taxonomy_get_term($tid) {
  static $terms = array();

  if (!is_numeric($tid)) {
    drupal_set_message('NOT numeric');
    return NULL;
  }
  if (!is_int($tid)) {
    drupal_set_message('NOT an integer');
    return NULL;
  }
  if (!isset($terms[$tid])) { // line 1087
  $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid));
  }

  return $terms[$tid];
}
reikiman’s picture

I also was wondering if it's a pathauto problem, so I filed an issue with that module here:

http://drupal.org/node/98510

reikiman’s picture

I put the above debugging code in, and got these messages:

    * NOT numeric
    * NOT numeric
    * Your Blog entry has been created.
    * NOT an integer
reikiman’s picture

This was already filed against pathauto: http://drupal.org/node/92900

RobRoy’s picture

Project: Drupal core » Pathauto
Version: 5.0-beta1 » 4.7.x-1.x-dev
Component: taxonomy.module » Code
Status: Active » Closed (duplicate)

Dupe.