On both the latest release as well as dev versions I am receiving the following notices when a user registers through the standard registration system without purchasing anything and having nothing in their cart and them clicking the validation link in the validation email.
Notices & Backtrace:
Notice: Undefined index: original in commerce_cart_user_update() (line 492 of /home/htdocs/sites/all/modules/commerce/modules/cart/commerce_cart.module).
Backtrace:
commerce_cart_user_update(Array, Object, NULL) user.module:101
user_module_invoke('update', Array, Object) logintoboggan.module:1006
_logintoboggan_process_validation(Object) logintoboggan.validation.inc:28
logintoboggan_validate_email(Object, '1365981304', 'fwQZSrawbSmRBlFrFbVFSsSPZyLeqF3HB1gxZyyv0xU')
call_user_func_array('logintoboggan_validate_email', Array) menu.inc:517
menu_execute_active_handler() index.php:28
Notice: Trying to get property of non-object in commerce_cart_user_update() (line 492 of /home/htdocs/sites/all/modules/commerce/modules/cart/commerce_cart.module).
Backtrace:
commerce_cart_user_update(Array, Object, NULL) user.module:101
user_module_invoke('update', Array, Object) logintoboggan.module:1006
_logintoboggan_process_validation(Object) logintoboggan.validation.inc:28
logintoboggan_validate_email(Object, '1365981304', 'fwQZSrawbSmRBlFrFbVFSsSPZyLeqF3HB1gxZyyv0xU')
call_user_func_array('logintoboggan_validate_email', Array) menu.inc:517
menu_execute_active_handler() index.php:28
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | logintoboggan-drupalcommerce_cart_userhookcompat-1970242-4.patch | 515 bytes | nicola.p |
Comments
Comment #1
damien tournoud commentedThis looks like a LoginToboggan bug. This module calls the
hook_user_update()hook in an incomplete way.Comment #2
nicola.p commentedI got same problem to investigate in, if you look at commerce_cart_user_update I think part of the the problem is in
that should be
or... btw... $account is the user object on which the operation is performed as stated in API for the hook, while $edit should have mail key which in this case can't have anyway since it's a empty array crafted by _logintoboggan_process_validation.
Look also @walkah comment on http://api.drupal.org/api/drupal/modules!user!user.api.php/function/hook...
*mumble+
Comment #3
bit.cyber commentedMy site is set up such that an anonymous shopper has to create an account upon purchase, and the site uses the LoginToboggan module. The purchase proceeds OK and an email is sent to the now registered user in due course as part of the registration process. Per the report for this issue, when clicking on the validation link in the email received, the same error message is shown.
For what it's worth, I tried the fix shown in comment #2, but now get an additional error message:
Otherwise the account has been validated. Their cart is of course empty given the purchase proceeded OK.
The site is using:
LoginToboggan 7.x-1.3
Commerce 7.x-1.6
Comment #4
nicola.p commentedSorry I was wrong :( , no
originalfor$accountat this stage (checked with kpr).Assumed that:
1.
_logintoboggan_process_validationpasses a object for parameter 1$accountwhich is ok!2.
_logintoboggan_process_validationpasses an empty array for parameter 2$editwhich is used in the hook withincommerce_cart_user_update, and that is not ok.Since the hook in
commerce_cart_user_updateis consistent with the API, we have to fill at least the array to not raise the error, I think a viable solution would be:before the call to
user_module_invoke('update', $edit, $account)in_logintoboggan_process_validationor
Comment #5
nicola.p commentedComment #6
nicola.p commented#5
Comment #7
Christopher Riley commentedThank you for that patch.
Comment #8
alexb03060 commentedThank you, works great.
Comment #9
hmartens commentedWhen is an update coming for this module or is it no longer being supported because the last time a new version came out was over 'n year ago? I want to use this module but scared it will mess up my commerce site :)
Comment #10
nicola.p commentedJust noticed that .... I'll say "LOL!" :)
Comment #11
poniesPatch in #5 works well for me.
Comment #12
damien tournoud commented#5 looks good to me too.
Comment #13
bennybobw commentedWorks for me as well
Comment #14
nodecode commented#5 does it for me. That makes 6 thumbs up. Can we get a commit?
Comment #15
jcisio commentedNow 7.
Comment #16
tannerjfco commentedI can also confirm this patch resolves the error specifically regarding commerce - however I'm also experiencing a similar error with search_api_saved_searches. Not sure if it's the same issue, but it looks very similar so I'm venturing that it's a distinct possibility.
If it is not the same issue, or is actually an issue with search_api_saved_searches, please feel free to disregard and set back to RTBC, and I will file new issues as necessary :)
Comment #17
deggertsen commented@Tannerjf It looks to me that what you are experiencing is probably a separate issue. I could be wrong, but setting this back to RTBC since the patch does fix the originally defined issue.
Comment #18
pscl commentedTannerjf,
I am getting the same Notice as you, when I click the validation link on the registration email:
Strangely, in my case it's line 245 of search_api_saved_searches.module.
I am using the LoginToboggan module.
Did you ever manage to resolve these notices?
Comment #19
deggertsen commentedIs this still a problem in 1.4? I'm hesitant to update to 1.4 while there are still several open issues including this one that have not been committed.
As for the issue in #16 and #18. I would look at the hook_user_update in the search_api_saved_searches.module file and possibly open a new issue for that module there. It's possible that it has something to do with logintoboggan, but I do believe it would be a separate issue from this one.
Comment #20
blogers commentedFor here the same problem some solution for this issue
Comment #21
dooug commentedComment #22
dooug commentedIt looks like this was solved in #2064919: commerce_cart_user_update assumes $edit['original'] exists
Also, based on how the core user module passes only changed values to the $edit parameter of hook_user_update(), I don't think the method the patch uses of setting
$edit['original'] = $account;is correct.Please re-open this if the notices continue to occur with the latest LoginToboggan and Commerce modules.
Please report #16 and #18 as a separate issue, unless it is in fact related.
Comment #23
dooug commented