Hello !
I'm not sure my problem is pathauto-specific, but I managed to solve it by modifying the pathauto module.
Context : I am writing a module which copies a CCK node using this methd :
$new_node = node_load($nid);
unset($new_node->nid);
node_save($new_node);
Doing so seems to work, but I get warnings :
warning: Illegal offset type in isset or empty in /var/www/html/modules/taxonomy/taxonomy.module on line 1150.
warning: Illegal offset type in /var/www/html/modules/taxonomy/taxonomy.module on line 1151.
warning: Illegal offset type in /var/www/html/modules/taxonomy/taxonomy.module on line 1154.
I discovered that these warnings where triggered by the pathauto module, in the node_get_placeholders() function.
The $first_term_id gets filled with an object such as :
stdClass Object ( [tid] => 44 [vid] => 1 [name] => My term [description] => [weight] => -2 [language] => [trid] => 0 )
I therefore modified the node_get_placeholders() function to add detection a such an object :
elseif (is_array($value)) {
$temptid = array_shift($value);
if ($temptid) {
$first_term_id = $temptid;
break;
}
}
+ elseif (isset($value->tid))
+ {
+ $first_term_id = $value->tid;
+ break;
+ }
elseif ($value) {
$first_term_id = $value;
break;
This solved my problem, but i'm still not sure it's really related to the pathauto module. What do you think about it ?
Comments
Comment #1
mwander commentedI'm seeing the same errors with in a slightly different scenario. (I think this is related.)
I create nodes using a script - including populating taxonomy and scheduler. Then, if I go in and change the unpublish date, then run cron to make it take effect, I see those same errors the first time I view a page with the changes.
Does this help in any way? Do you think it might be related?
Same version of pathauto.
Thank you.
Comment #2
gregglesperhaps you could try out the patches in this issue: http://drupal.org/node/123001
It seems similar to your situation if not exactly the same.
Comment #3
deelight commentedThanks for the link, the patch given seems to be the same as mine, so I guess it's ok :)
Comment #4
gregglesThat's good to hear.
Can you clarify what kinds of situations you use your site for? Are you only building nodes in the manners described below or are you also creating them in the normal (manual) manner?
My concern is that this new code will work for your scenario but not the old one.
Thanks!
Comment #5
deelight commentedI also create nodes the normal way.
My module only duplicates a bunch of CCK nodes, once a year. All these nodes are associated with taxonomy terms, and automagically get a friendly url thanks to pathauto. The duplication code in my module is really simple, it basically does :
Comment #6
mwander commentedPer your request, done. #31 at the URL you listed. Resolved. Thank you!