Hi,

in my watchdog log, I'm getting numerous notices like this:

Notice: Trying to get property of non-object in pathauto_token_values() (line 142 of /var/www/drupal/sites/all/modules/pathauto/pathauto.module).

Since the severity is marked as "error" I'd like to get rid of this.

Probably related:

Notice: Trying to get property of non-object in node_token_values() (line 34 of /var/www/drupal/sites/all/modules/token/token_node.inc).

The referrer for both groups or errors is a View at ./image/recent.

Versions: Pressflow 6.22.x, views 6.x-2.12, token 6.x-1.16. Please feel free to adjust the issue queue if it might fit somewhere else better.

Thanks!

CommentFileSizeAuthor
#1 pathauto-1319666-1.patch782 bytessmokris
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

smokris’s picture

Version: 6.x-1.5 » 6.x-1.x-dev
Status: Active » Needs review
FileSize
782 bytes

pathauto.module shouldn't assume that the object hook_token_values() is non-null. Patch attached.

Dave Reid’s picture

A node object that doesn't have a value for $node->vid wouldn't be a valid node object would it? Under what conditions is this happening?

smokris’s picture

According to the hook_token_values() documentation, the object parameter is optional (defaults to NULL), so it's valid for modules making use of tokens to try to fetch tokens for the 'node' type without specifying any particular node object. That seems to be what was happening here.

Dave Reid’s picture

It's only optional if you use $type = 'global'. It is not optional if $type = 'node'.