Hi

I am using pressflow and changed today my legal. After tying to log in I land on the legal_accept page and getrting this bunch of errors.

Warning: Parameter 3 to block_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 3 to comment_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to dblog_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 3 to locale_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to node_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to profile_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 3 to system_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to user_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to apachesolr_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to appbar_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to cacherouter_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to imagecache_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to imagecache_profiles_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to legal_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to logintoboggan_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to meshle_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to piwik_api_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to pm_block_user_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to pm_email_notify_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to privatemsg_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to privatemsg_filter_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to reg_with_pic_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to user_relationships_api_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to user_relationships_ui_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to user_relationship_mailer_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to user_stats_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to pathauto_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

Warning: Parameter 2 to i18n_user() expected to be a reference, value given in module_invoke_all() (line 483 of /home/user1/public_html/includes/module.inc).

I use php 5.3 and the pressflow distribution. Is there an easy way to solve this problem?

Comments

broncomania’s picture

Update: So I found out when I comment module_invoke_all('user', 'logout', NULL, $user); the warnings are gone but what side effects will occur if I comment this out?

tinker’s picture

This is caused by a 'value' being passed instead of a 'reference' in a module that user module_invoke_all().

Search all modules code for:module_invoke_all('user'

You should see something like: module_invoke_all('user', 'logout', $null, $user);

If you find one where the third or fourth variables do not have a $ in front of them it will probably be the problem.

I have found old code that uses: module_invoke_all('user', 'logout', NULL, $user);

NULL cannot be passed in this case. You need to add "$null = NULL;" before the offending line and then change the offending line using $null instead of NULL

Do not change the first two variables.

// original code
module_invoke_all('user', 'logout', NULL, $user);

// Fixed code
$null = NULL;
module_invoke_all('user', 'logout', $null, $user);

Please report your findings so that they can be fixed for everyone.

robert castelo’s picture

Status: Active » Closed (won't fix)

Not caused by Legal module.

adelayde’s picture

Version: 6.x-2.4-rc2 » 7.x-1.x-dev
Component: Code » Documentation
Status: Closed (won't fix) » Closed (works as designed)

I had this problem in a bespoke module of mine, the same thing, the third (in this case) parameter that I was passing was 'NULL'. So I changed:

module_invoke_all('user','logout', NULL, $user);

to

module_invoke_all('user','logout', $null = NULL, $user);

Note the one-liner, nice and short :)

retiredpro’s picture

6.x-8.5 and 6.x-8.x-dev has the 3rd parameter as NULL on line 289 on legal.module

module_invoke_all('user', 'logout', NULL, $user);

tinker’s picture

Version: 7.x-1.x-dev » 6.x-8.x-dev
Component: Documentation » Code
Status: Closed (works as designed) » Needs review
StatusFileSize
new608 bytes

Confirmed that this is an issue in 6.x-8.x-dev. Attached patch.

adelayde’s picture

I was getting the following error message:

Warning: Parameter 3 to ckeditor_user() expected to be a reference, value given in module_invoke_all()

I couldn't do the fix described here because the call to ckeditor_user() comes from module_invoke_all().

I spotted this in the PHP documentation (http://uk.php.net/manual/en/language.references.pass.php#106208):

"Please note that you can't pass NULL to a function by reference, unless it's as a default value."

Therefore, if I modify the function spec of ckeditor_user() from:

function ckeditor_user($type, $edit, &$user, $category = NULL)

to

function ckeditor_user($type, $edit, &$user = NULL, $category = NULL)

It appears to fix the issue.

Anyone think I should be submitting this as a patch, or have I got the wrong end of the stick?

tinker’s picture

Sorry @adelayde, but as you so nicely put it, you do have the wrong end of the stick. function ckeditor_user() is fine as is. You are trying to treat the symptom rather than using the cure. The problem is caused by module_invoke_all() passing the NULL value. You had it right in post #4. Module_invoke_all() can be used by many modules so you may have many (faulty) occurrences of it by different modules. You have already mentioned bespoke, ckeditor, and this is the legal module issue queue. Did you follow the directions in post #2? If you search for "module_invoke_all('user" and fix all occurrences where the 3rd or 4th variable does not have "$" in front you will be fine. You do not need to roll a patch for your fix.

BTW this is all because of error reporting levels in PHP and changes made in PHP v5.3. The code does function its just warning that it should get fixed. You could just reduce the error reporting level.

shaneonabike’s picture

Actually this is a bit of an issue...

You have (on line 290) of legal.module

module_invoke_all('user', 'logout', NULL, $user);

and it seems changing this to $null = NULL still blows up and doesnt work :/

tinker’s picture

@ShaneOnABike, Did you flush your caches? Did you search all your modules as in post #2? Do you need depreceated error reporting on?

shaneonabike’s picture

Yep I've flushed my caches a bunch of times... I haven't checked other modules thought.. but that line isn't correct though right?

tinker’s picture

Patch in #6 should fix the issue in this modules. Other modules could be causing the same exact error.

shaneonabike’s picture

Sorry I didn't see the patch :/ just used the latest but would be good to deploy this is the latest release :)

catch’s picture

Status: Needs review » Closed (duplicate)

This is a duplicate of #951914: PHP 5.3 Compatibility which is now RTBC.