Change record status: 
Project: 
Introduced in branch: 
6.x, 7.x
Introduced in version: 
6.35, 7.35
Description: 

The user_pass_rehash() function in Drupal 6 and 7 is used for generating time-dependent per-user links, for example one-time login links.

In Drupal 6.35 and Drupal 7.35, a new parameter was added to this function to fix security issues (see SA-CORE-2015-001); the user account ID should now be passed in.

Before:

$timestamp = REQUEST_TIME; // In Drupal 6, use time() instead.
$account = user_load($uid);
$hash = user_pass_rehash($account->pass, $timestamp, $account->login);

After:

$timestamp = REQUEST_TIME; // In Drupal 6, use time() instead.
$account = user_load($uid);
$hash = user_pass_rehash($account->pass, $timestamp, $account->login, $account->uid);

If code is not updated for this change, Drupal will generate a PHP warning every time it is called. For backwards compatibility, the generated hash will still work correctly when it is possible to securely do so; however on some sites and in some situations the hashes will not work correctly until the code has been updated to pass in the user ID.

Impacts: 
Module developers

Comments

sfederico’s picture

Hi,
i upgrade my drupal site to 7.35... and in register process when create e new account or reset password i have warning about number parameters of function user_pass_rehash in i18n\i18n_user\i18n_user.module at line 68 and 57... i hope to insert $account->uid parameters but registration don't work... any idea?

Thanks a lot

tlito’s picture

Having these messages after registration:
Warning: Missing argument 4 for user_pass_rehash(), called in sites/all/modules/i18n/i18n_user/i18n_user.module on line 57 and defined in user_pass_rehash() (line 2406 of modules/user/user.module).
Warning: Missing argument 4 for user_pass_rehash(), called in sites/all/modules/i18n/i18n_user/i18n_user.module on line 68 and defined in user_pass_rehash() (line 2406 of modules/user/user.module).
Warning: Missing argument 4 for user_pass_rehash(), called in sites/all/modules/i18n/i18n_user/i18n_user.module on line 57 and defined in user_pass_rehash() (line 2406 of modules/user/user.module).
Warning: Missing argument 4 for user_pass_rehash(), called in sites/all/modules/i18n/i18n_user/i18n_user.module on line 68 and defined in user_pass_rehash() (line 2406 of modules/user/user.module)

I've found your answer and patch solved this. Thank you!!

andypost’s picture