I'm getting the following warnings on nodes where the node's content type does not have any user reference fields assigned.

WARNING OCCURS ONLY ON PREVIEW PAGE.. Also, ADMIN user does not receive the warning. If user skips Preview and simply save node, user does not receive the warning.

Warning: Illegal offset type in isset or empty in nodeaccess_userreference_node_access() (line 401 of /Users/cale/Sites/acquia-drupal/sites/all/modules/nodeaccess_userreference/nodeaccess_userreference.module).

references to related threads:

http://drupal.org/node/1262788

http://drupal.org/node/1198498

CommentFileSizeAuthor
#6 illegal offset backtrace.jpg115.07 KBcalefilm

Comments

danielb’s picture

Are you using i18n ?

#1262800: node_access in i18n_node: ('create', $node) or ('create', $node->type) or ('update', $node)

If not some other module or core is calling node_access('create', $node) which is incorrect according to the API documentation for node_access() which says that when the $op is 'create' the 2nd param should be a string containing the node type.

calefilm’s picture

No. But thanks for the response. When I can find out I will report back.

danielb’s picture

Status: Active » Postponed (maintainer needs more info)

You could probably debug that bit of code where the error happens, if the op is 'create' but is_object($node) is TRUE, get the data from debug_backtrace() to see who is calling node_access()

calefilm’s picture

Would that be using devel? I just downloaded the module but forgot how to implement backtrace as I was instructed once before on how to do it. Are there simple instructions you can refer me to on drupal to do a backtrace? Thanks

danielb’s picture

debug_backtrace() is a PHP function that returns an array of data so you can figure out what called the current function, and what called that, and so on... However, it returns way too much info than you usually need, so you need to carefully pick through it, or only output a small portion of it to prevent problems with the page loading.
There might be helpful stuff in devel to do it, but I'm not aware.

off the top of my head...

<?php
if ($op == 'create' && is_object($node)) {
  $backtrace = debug_backtrace();
  dpm($backtrace[0]); //  Print out the last bit of the backtrace
  dpm($backtrace[1]); //  Print out the second last bit of the backtrace

  etc...
}
?>

you might have to go back a few steps to see which code is calling the function node_access().

calefilm’s picture

StatusFileSize
new115.07 KB

I entered the code you suggested but in order to see anything I had to give devel permissions to my member users (i'm using localhost) in order to see the error and get the array to show.. Am I doing it right so far? I don't know what I'm looking for either.. But kinda feel i'm not doing it the right way. I don't know if the array is identifying the error above in red.

Array 2 Elements:

. (Array, 2 elements)
function (String, 36 characters ) nodeaccess_userreference_node_access | (Callback) nodeaccess_userreference_node_access();
args (Array, 3 elements)
0 (String, 9 characters ) interview
1 (String, 6 characters ) create
2 (Object) stdClass
uid (String, 1 characters ) 2
name (String, 4 characters ) cale
pass (String, 55 characters ) $S$DDR2fsw5tQFRZvxvPGrOv7EwhUTIZE9ef92riw8ZAyG5...
mail (String, 11 characters ) bob@aol.com
theme (String, 0 characters )
signature (String, 0 characters )
signature_format (String, 13 characters ) filtered_html
created (String, 10 characters ) 1331264165
access (String, 10 characters ) 1341984844
login (String, 10 characters ) 1341638728
status (String, 1 characters ) 1
timezone (String, 15 characters ) America/Chicago
language (String, 0 characters )
picture (String, 3 characters ) 282
init (String, 11 characters ) bob@aol.com
data (Boolean) FALSE
sid (String, 43 characters ) 1YMUyPp3F8t812kKGPQxndevsSdRF8TXL7g0bwFlIuM
ssid (String, 0 characters )
hostname (String, 9 characters ) 127.0.0.1
timestamp (String, 10 characters ) 1341984844
cache (String, 1 characters ) 0
session (String, 394 characters ) clickpath|a:5:{s:51:"node/add/sites/default/fil...
roles (Array, 2 elements)
$...['args'][2]->roles
2 (String, 18 characters ) authenticated user
4 (String, 15 characters ) featured writer

Array 4 elements:

... (Array, 4 elements)
file (String, 51 characters ) /Users/cale/Sites/acquia-drupal/includes/module...
line (Integer) 823
function (String, 20 characters ) call_user_func_array | (Callback) call_user_func_array();
args (Array, 2 elements)
0 (String, 36 characters ) nodeaccess_userreference_node_access | (Callback) nodeaccess_userreference_node_access();
1 (Array, 3 elements)
1 (String, 9 characters ) interview
2 (String, 6 characters ) create
3 (Object) stdClass
uid (String, 1 characters ) 2
name (String, 4 characters ) cale
pass (String, 55 characters ) $S$DDR2fsw5tQFRZvxvPGrOv7EwhUTIZE9ef92riw8ZAyG5...
$S$DDR2fsw5tQFRZvxvPGrOv7EwhUTIZE9ef92riw8ZAyG5xMQpUlqC
mail (String, 11 characters ) bob@aol.com
theme (String, 0 characters )
signature (String, 0 characters )
signature_format (String, 13 characters ) filtered_html
created (String, 10 characters ) 1331264165
access (String, 10 characters ) 1341984844
login (String, 10 characters ) 1341638728
status (String, 1 characters ) 1
timezone (String, 15 characters ) America/Chicago
language (String, 0 characters )
picture (String, 3 characters ) 282
init (String, 11 characters ) bob@aol.com
data (Boolean) FALSE
sid (String, 43 characters ) 1YMUyPp3F8t812kKGPQxndevsSdRF8TXL7g0bwFlIuM
ssid (String, 0 characters )
hostname (String, 9 characters ) 127.0.0.1
timestamp (String, 10 characters ) 1341984844
cache (String, 1 characters ) 0
session (String, 394 characters ) clickpath|a:5:{s:51:"node/add/sites/default/fil...
roles (Array, 2 elements)
2 (String, 18 characters ) authenticated user
4 (String, 15 characters ) featured writer
danielb’s picture

bugger it, i'll just patch the function to accept node object

danielb’s picture

Status: Postponed (maintainer needs more info) » Fixed

should be right now

calefilm’s picture

sorry to bring more problem news but after updating to dev now I have this issue: http://drupal.org/node/1689886

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

edit