When I upgraded nodeaccess_userreference to version 6.x-3.0, I started seeing the following warning with devel_node_access enabled:

Warning: implode() [function.implode]: Invalid arguments passed in nodeaccess_userreference_node_access_explain() (line 227 of /home/paul/work/git/events/sites/all/modules/nodeaccess_userreference/nodeaccess_userreference.module).

The problem is the following line:

$do = implode('/', $ops);

If $ops is empty (because there were no grants), an empty array is passed to implode(). PHP 5.3 does not like this.

Thank you for this module, by the way. Even with this minor error, it works well for my application.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

paulmckibben’s picture

Status: Active » Needs review
FileSize
2.04 KB

Patch attached. Please let me know if I need to change anything. Thanks again!

paulmckibben’s picture

Version: 6.x-3.0 » 6.x-3.x-dev

Oh, by the way, the above patch is against the 6.x-3.x branch in git, not on the 6.x-3.0 code. Sorry!

danielb’s picture

Why not just initialise $ops to array() ?

If $ops is empty (because there were no grants), an empty array is passed to implode(). PHP 5.3 does not like this.

I disagree with this assessment. Empty arrays should be OK in implode(). Variables that don't exist, however, are not OK.

danielb’s picture

Status: Needs review » Fixed

I've committed that, it should get rid of the error.

paulmckibben’s picture

Yes, much simpler. With your one-line change, the error is gone. However, the resulting "explain" strings are still funny, because the $do string is empty. Example: "All users may this node".

I'll be glad to write a different issue for this; just let me know. Definitely not critical, as only developers will ever see these strings.

Again, thank you for this valuable module!

danielb’s picture

Status: Fixed » Active

I'll look into that, cheers. Probably a few modules I need to update that on.

danielb’s picture

Status: Active » Fixed

committed, and will appear in future releases

Status: Fixed » Closed (fixed)

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