This problem can occur when using uuid_features, in conjunction with a node access module like content_access.module. If you are exporting nodes for a content type for which access is being controlled, for following errors will occur when running cron.php from an unauthenticated client:

WD php: Notice: Trying to get property of non-object in uuid_node_features_export_render() (line 76 of                                                  [error]
/NetBeansProjects/wpg/sites/all/modules/uuid_features/includes/uuid_node.features.inc).
WD php: Notice: Trying to get property of non-object in content_uuid_node_features_export_render_alter() (line 16 of                                    [error]
/NetBeansProjects/wpg/sites/all/modules/uuid_features/includes/modules/content.inc).
WD php: Notice: Trying to get property of non-object in nodereference_uuid_node_features_export_render_alter() (line 44 of                              [error]
/NetBeansProjects/wpg/sites/all/modules/uuid_features/includes/modules/nodereference.inc).
WD php: Notice: Trying to get property of non-object in filefield_uuid_node_features_export_render_alter() (line 44 of                                  [error]
/NetBeansProjects/wpg/sites/all/modules/uuid_features/includes/modules/filefield.inc).

It's very easy to see the problem if you simply execute "drush core-cron".

The problem, AFAICT, is that node_get_by_uuid() uses db_rewrite_sql(). Subsequently node access grant clauses are written into the query that loads the node. Since we are anonymous, no node object will be returned (and rightly so).

I'm not entirely sure why hook_features_export_render() gets called on cron runs, but I'll assume Features does it by design.

The attached patch checks for an empty $node object after attempting to load.

CommentFileSizeAuthor
node_access_errors.patch814 bytesryan_courtnage

Comments

JeremyFrench’s picture

I think that this module should perhaps warn if no UID is present. I was having an issue with the path not being set on imported nodes when running via drush. This was again a permissions issue.

For the record when using drush you can get round this with the parameter -u 1

ryan_courtnage’s picture

avpaderno’s picture

Version: 6.x-1.0-alpha1 » 6.x-1.x-dev
Status: Needs review » Closed (outdated)
Issue tags: -drush, -content_access +Content access

I am closing this issue, as Drupal 6 is now not supported.