2

I'm experiencing a strange issue that I'm having a really hard time debugging.

When I save a user account (of an authenticated user) as an admin, the account is saved, but when the page reloads I get an access denied and I am suddenly logged in as the user I saved, not the admin. This happens whether I save the account in the UI (via the People page) or save the account using a rules action.

Recently, I added a custom function and modified a few of my rules, so these changes are likely to be the cause of the problem. The site is version-controlled using git, so I can roll back to a working version, but I would like to attempt to determine what I did wrong.

I have Netbeans working with Xdebug. I just don't know where to set breakpoints or how otherwise to start looking for the source of this problem.

2

Can you re-produce the problem from CLI?

Using drush scr, bootstrap, login as user 1, save a new user, check if your ID changed.

If you can do this from CLI, git bisect can be very helpful in finding the commit that caused it.

  • 1
    Wow, I didn't know about drush scr. I will try to do this but first I will need to track down some examples. – Patrick Kenny Jun 29 '13 at 13:46
  • It turns out you can't call user_load() from within hook_user_presave(). – Patrick Kenny Jun 30 '13 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.