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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | user-search-3033131-2.patch | 663 bytes | leducdubleuet |
Comments
Comment #2
leducdubleuet commentedHere is the very simple patch, needs review. Thanks.
Comment #3
jkingsnorth commentedConfirmed the functionality still works, and this removes the annoying notices!
Setting to RTBC.
Thanks for the patch.
Comment #4
alisonComment #5
alisonNote to check this **possibly** related issue: #3062517: Notice Undefined index: values in nodeaccess_grants_form()
Comment #6
alisonComment #7
alisonComment #9
alison