This might too much of an edge case for most people, but we have a cron job which synchronises user accounts from a remote server. When an account has a role which matches the password policy we have setup (accounts with certain admin roles only), and the account is due for a password expiry, password_policy_user_update() creates a watchdog message. This message assumes the active user is a real person, which isn't the case during cron, and so $user->name does not exist and causes an extra watchdog message.
The attached patch fixes this by providing an alternative watchdog message when the global uid is zero.
Comments
Comment #2
AohRveTPV CreditAttribution: AohRveTPV commentedSetting to 'Needs review' to run automated tests.
Comment #3
AohRveTPV CreditAttribution: AohRveTPV commentedAdded a comment to explain the
!$user->uid
condition. Going to go ahead and commit if tests pass, but please let me know if it is inaccurate.Reading the Password Policy code I have often wondered the purpose of various conditions so I want to make sure to document them going forward.
Comment #4
AohRveTPV CreditAttribution: AohRveTPV commentedComment #6
AohRveTPV CreditAttribution: AohRveTPV commentedComment #8
AohRveTPV CreditAttribution: AohRveTPV commentedIt tested the D6 patch on D7 for some reason. Retesting. Maybe you can't change the version in the same comment as you set a patch to 'Needs review', if you want the tests to run on the new version.
Comment #9
AohRveTPV CreditAttribution: AohRveTPV commentedNeither 7.x-2.x nor 8.x-3.x generate a notice like this one, so this change in non-applicable to those branches.
Comment #11
AohRveTPV CreditAttribution: AohRveTPV commented