After upgrading to the latest version of the Gallery2 module from the previous current release, the following error message appears when a new user tries to register:
warning: __clone method called on non-object in /home/.gob/xxxxx/drupal5/includes/common.inc on line 1376
- The user/register page appears to be the only place where this error occurs.
- Enabling/disabling the module toggles the error on/off.
- Turning caching on/off does not seem to influence the issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | gallery_user_clone.patch | 1.08 KB | profix898 |
Comments
Comment #1
bjmiller commentedThe following seems to have fixed it for me. You'll need to clear your website's cache if it is enabled to see the results.
At line 69 in gallery.module:
change
to:
Comment #2
mynameisbrian commentedThat fix gets rid of the error on the /user/register page, but after submitting a username and email address, the same error shows up on the redirect page (usually the defauly front page), and no authorization email is sent to the user. Any ideas?
Comment #3
profix898 commentedI will take a look at this ... shouldnt be too difficult to fix ...
Comment #4
mynameisbrian commentedActually the "not sending an authorization email" part of my previous post was a bug on my end. However, the common.inc line 1375 error still pops up after a registration request. I actually just commented the line out of that file, as it mentions it's a substitute function for PHP4, but I'm using PHP5. Still, it'd be good to figure out what's causing this.
Comment #5
profix898 commentedCan you please review the attached patch. hook_user is called multiple times during the registration process with $edit/$user not being set or empty ... The patch moves the drupal_clone() to insert/update op where it is actually needed.
@mynameisbrian: In PHP5 all objects are passed by reference by default. To prevent alteration of the user object in gallery_user_* the drupal_clone() call is needed. In PHP4 cloning is not necessary. The Drupal documentation for the function is a little misleading though.
Comment #6
bjmiller commentedThanks. I rolled back my temporary fixes and applied your patch. Seems to work well.
Comment #7
profix898 commentedPatch committed to Drupal-5 branch. Thanks.
Comment #8
(not verified) commented