Problem/Motivation

When searching for user on the Grants tab for nodes with version 1.6, we get a notice and a warning :

Notice: Undefined index: uid in nodeaccess_grants_form() (line 235 of /srv/www/dev-fondation/sites/all/modules/nodeaccess/nodeaccess.module).
Warning: array_keys() expects parameter 1 to be array, null given in nodeaccess_grants_form() (line 235 of /srv/www/dev-fondation/sites/all/modules/nodeaccess/nodeaccess.module).

That line 235 was simply out of place, it needs to be inside the isset check just below :

    if (isset($form_values['uid']) && count($form_values['uid'])) {
      $uid = array_keys($form_values['uid']);
      $query->condition('uid', $uid, 'NOT IN');
    }

Steps to reproduce:
- Go to the "Grants" tab on any node (i.e. /node/1234/grant ).
- Start typing a username where it says "Enter names to search for users".
- Click a username from the autocomplete suggestions.
- Click "Search"
- Check "recent log messages" / "watchdog-show"
- You'll see the aforementioned "Notice" and "Warning" log messages.

Proposed resolution

(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)

Remaining tasks

Patch coming up...

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#2 user-search-3033131-2.patch663 bytesleducdubleuet

Comments

LeDucDuBleuet created an issue. See original summary.

leducdubleuet’s picture

StatusFileSize
new663 bytes

Here is the very simple patch, needs review. Thanks.

jkingsnorth’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed the functionality still works, and this removes the annoying notices!
Setting to RTBC.
Thanks for the patch.

alison’s picture

Version: 7.x-1.6 » 7.x-1.x-dev
Issue tags: +Release blocker
alison’s picture

Note to check this **possibly** related issue: #3062517: Notice Undefined index: values in nodeaccess_grants_form()

alison’s picture

Issue summary: View changes
alison’s picture

alison’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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