When programmatically creating a new node that uses the following pathauto setting in the $node object:
$node->path['pathauto'] = TRUE;
The following notice sometimes arises:
Notice: Undefined index: alias in path_node_insert() (line 187 of /####/modules/path/path.module).
Notice: Undefined index: alias in path_node_update() (line 204 of /####/modules/path/path.module).
Upon inspection of the path.module file, I found that both of these notices were on variables that weren't first checked by isset() or empty() before performing a trim() on them. Here's the line in both instances:
$path['alias'] = trim($path['alias']);
After moving this line to inside the if statement in both instances:
if (!empty($path['alias'])) {
...
}
This resolved the problem.
Obviously this is not a horrible issue, however, it did fill up my cron logs with tons of notices. So, hopefully this will get fixed in future versions of drupal.
Comments
Comment #1
marcingy commentedThis sound more like a pathauto issue than a core issue.
Comment #2
mrharolda commentedI can confirm this issue.
Comment #3
dave reidHere's how you can avoid it. Also set
$node->path['alias'] = '';. I'm going to file a patch against core's path module to make this more flexible.Comment #4
dave reidThis is a duplicate of #1328180: Minor error when upgrading nodes programmaticly.