I'm using user_external_login_register() as part of an external authentication module. I'm passing it good information, but it's throwing the following notice;
Notice: Undefined index: mail in user_save() (line 567 of /modules/user/user.module).
The line it's calling is $edit['mail'] = trim($edit['mail']);
I noticed that user_external_login_register() does not pass 'mail' as part of the array to user_save(). Seems it may be easiest just to throw an IF statement around that line making sure the index 'mail' exists?
I apologize if I posted this in the wrong place, just something I noticed and wanted to bring to the community's attention.
Comment | File | Size | Author |
---|---|---|---|
#4 | mail_fix.patch | 542 bytes | divzero |
#3 | mail_fix.diff | 542 bytes | divzero |
Comments
Comment #1
accusoft CreditAttribution: accusoft commentedas an update to this, I changed line 567 in users.module to:
if (isset($edit['mail']))
{
$edit['mail'] = trim($edit['mail']);
}
and it's working perfectly now.
My preference is not to "hack the core" so I would like more opinion on this.
Comment #2
daften CreditAttribution: daften commentedsubscribe
Comment #3
divzero CreditAttribution: divzero commented+1
I've created accudev's fix as a patch. Attached.
Comment #4
divzero CreditAttribution: divzero commentedupdated patch
Comment #5
divzero CreditAttribution: divzero commentedComment #6
arosboro CreditAttribution: arosboro commentedI just ran into this issue as well. Thanks for the patch.
Comment #7
arosboro CreditAttribution: arosboro commentedI got a malformed error trying to use this patch on drupal 7 from the root directory
Comment #8
guybrush CreditAttribution: guybrush commentedThis seems like a major issue, as it effectively renders the user_external_login_register() functionality useless. It seems that it is not possible to use this function for handling remote logins without a fix.
Comment #9
JeebsUK CreditAttribution: JeebsUK commentedI would concur with the above comment. I understand why the patch has been implemented in the way it has because you are never guaranteed an email address, but we need to be sure the patch wouldn't affect other things adversely.
Comment #10
bajnokk CreditAttribution: bajnokk commentedsubscribe, on behalf of shib_auth.
Comment #11
SilviaT CreditAttribution: SilviaT commentedsub