user id to assign roles upon buying a recurring payment product is incorrectly set, due to an array/object mismatch. in addition, the user_save function is always called, even if there are no roles to assign or the user is incorrect. this gives an SQL error when simply buying recurring payment product without any roles to assign :

user error: Duplicate entry '' for key 2
query: INSERT INTO users (created, uid) VALUES ('1128337437', '16')

hopefully the insert is not working :)

please find attached a patch to fix this issue by adding a call to object2array and checking for user status and roles to be assigned before calling user_save.

the array/object problem is recurring, and i think a global consistency project on this could be a good idea. i would be glad to help after input of ecommerce people on this, as moving everything to objects/arrays can break a lot of things along the code.

CommentFileSizeAuthor
ec-store-roles-fix_0.patch1.7 KBsyllance

Comments

matt westgate’s picture

Status: Needs review » Fixed

I committed a modified patch to HEAD. There was a deeper issue in that users were being assigned the membership role even with a failed payment status.

Anonymous’s picture

Status: Fixed » Closed (fixed)