I have a custom module which is supposed to change a user's profile picture.

When you are logged in as a super-admin, the module works fine. Problems arise, however, when you log in as a regular user.

I believe that entity_load() is causing infinite recursion, either crashing PHP (due to an xdebug limitation) or running to the PHP memory limit.

I located something similar here, but that's from 2009! Surely it's been integrated into Drupal's core by now, yes? Also, I tried to apply the last green patch using Git, but it appears that the directory structure is different than my install? common.inc is definitely in my includes folder, but there's no node folder in my includes folder, so I'm not quite sure how to apply it..

The full stack trace can be found here

If anyone could help me figure out what I need to do to fix this, I'd be very appreciative.

  • Any chance you're calling user_load() from inside a hook_user_load() or hook_entity_load() implementation? Something like that would explain it. The patch you linked to has been in for ages so it's not that – Clive Sep 26 '13 at 17:07
  • What does realname_user_load do? Is it a get funtion? It is named as a hook as well. This has caused me trouble in the past, too. – larrydahooster Sep 26 '13 at 17:10
  • In case XDebug is masking a potential error report by crashing out, try upping the max nesting in php.ini to something like xdebug.max_nesting_level = 10000 temporarily. – Clive Sep 26 '13 at 17:14
  • I'm definitely not calling user_load() from within either of those hooks within my own module, but @larrydahooster has a point in that it looks like maybe the realname module is doing it? I've been looking through their code and can't see where they would do that, though... – tigertrussell Sep 26 '13 at 17:15
  • Nah realname_user_load() behaves itself, it's not to blame. It's just an implementation of hook_user_load() that gets called every time user_load() does. If there's a bunch of user data on the page it's perfectly normal to see that – Clive Sep 26 '13 at 17:16

Your Answer

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

Browse other questions tagged or ask your own question.