Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently
Initiating masquerade: "User DestinationUser masqueraded as DestinationUser."
Terminating masquerade: "User SourceUser stopped masquerading as SourceUser."
Must be
Initiating masquerade: "User SourceUser masqueraded as DestinationUser."
Terminating masquerade: "User SourceUser stopped masquerading as DestinationUser."
Problem
Variable $account is changed by ...->setAccount();
$account = $this->currentUser;
...
$this->currentUser->setAccount($new_user);
...
$this->logger->info(..., $account->getDisplayName() );
Solution
- $account = $this->currentUser;
+ $account = $this->currentUser->getAccount();
Comment | File | Size | Author |
---|---|---|---|
#2 | masquerade-2743333-fix-watchdog-begin-end-messages.patch | 866 bytes | ragnarkurm |
Comments
Comment #2
ragnarkurm CreditAttribution: ragnarkurm as a volunteer commentedComment #3
ragnarkurm CreditAttribution: ragnarkurm as a volunteer and at Wunder commentedComment #4
andypostComment #5
hgoto CreditAttribution: hgoto as a volunteer commentedI tested the patch #2 and I confirmed it fixes the issue. It's simple and I'd like to move this to RTBC.
The following is off-topic. How about changing the variable name for more code readability? For example, in the method
switchTo()
, the variable$account
means the original account that going to masquerade another user. So$original_account
is more easy-to-understand name thanaccount
, I think. But this may be against the policy or something. I'd like to hear other opinion.Comment #7
andypostThanx, commited and pushed!
@hgoto Please file new issue, I think
$target_account
is nicely describes the target of the function but probably better to extend code comments and change local variable names - suggestions are welcome in separate issue)Comment #8
hgoto CreditAttribution: hgoto as a volunteer commented@andypost, thank you for your reaction. I see. I understood! I'll file a new issue.