On editing a node, I am getting this error:

Notice: Array to string conversion in content_permissions_field_access() (line 25 of /sites/all/modules/cck/modules/content_permissions/content_permissions.module).

The line in question is: return user_access($op .' '. $field['field_name'], $account);

The error is due to the fact that $field['field_name'] is an array and not a string like it should be.

I traced this back to this function:

function nodereference_autocomplete_access($field_name) {
  return user_access('access content') && ($field = content_fields($field_name)) && isset($field['field_name']) && content_access('view', $field) && content_access('edit', $field);
}

The $field_name parameter is coming in empty which is causing $field to be set to all of the fields instead of just one, which is making the nested array.

I haven't been able to figure out why the parameter is empty, yet, and would appreciate any suggestions. I'm not sure if this is a bug or something specific to this site so putting it as a support request.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Michelle’s picture

Title: nodereference_autocomplete_access empty parameter » nodereference_autocomplete_access conflicts with a field named field_name
Category: Support request » Bug report
Status: Active » Needs review
FileSize
832 bytes

I still don't know why this function is being called on the field listing with an empty parameter but that may or may not be an issue. This particular issue is due to the fact that there is a field with a machine name of field_name that is causing a false positive when the code checks for isset($field['field_name'] which in turn causes the access check on $field which at that point has a whole list of fields and not just one.

To fix this, I checked to see if the parameter was empty before calling content_fields with it which short circuits the whole thing and avoids the issue.