Problem/Motivation
Found frequent occurrences of the following error on a live site using the countryban module:
Parameter 2 to countryban_user() expected to be a reference, value given in .../includes/module.inc on line 497.
This is caused by the following code in the countryban_user() function of countryban/countryban.module:
module_invoke_all('user', 'logout', NULL, $user);
The module_invoke_all() function should never be used to invoke hook_user(). The user_module_invoke() function should be used instead. Additionally, the $edit (second) parameter to hook_user() is required to be an array reference. Passing NULL would cause a PHP warning even if user_module_invoke() were used.
Proposed resolution
The call to module_invoke_all() should be replaced by a call to user_module_invoke() and a temporary $edit variable passed as the second parameter.
Remaining tasks
A patch needs to be written, reviewed, and applied.
User interface changes
None.
API changes
The Drupal API would be used correctly.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | countryban-user_module_invoke-1533026-1.patch | 1.72 KB | pillarsdotnet |
Comments
Comment #1
pillarsdotnet commentedTrivial patch attached:
Comment #2
jboukes commentedFixed as of 1.4
Comment #3.0
(not verified) commentedPatch submitted.