Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When user_save is called without a mail attribute, a warning is issued by php:
Notice: Undefined index: mail in user_save() (line 536 of .../modules/user/user.module).
This happens for instance when a new user is registered in user_external_login_register.
Steps to reproduce
Proposed resolution
Remaining tasks
Write a test
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#9 | 817482-by-Stevel-user_save-issues-a-warning-wh.patch | 1023 bytes | bfroehle |
#4 | 817482-user-save-without-mail.patch | 747 bytes | Stevel |
#3 | 817482-user-save-without-mail.patch | 708 bytes | Stevel |
#1 | 817482-user-save-without-mail.patch | 708 bytes | Stevel |
Comments
Comment #1
Stevel CreditAttribution: Stevel commentedPatch added
Comment #3
Stevel CreditAttribution: Stevel commentedReroll for latest HEAD
Comment #4
Stevel CreditAttribution: Stevel commentedrediff from drupal root directory
Comment #5
Jelle_Sthis patch solves the error described in the issue
Comment #6
bfroehle CreditAttribution: bfroehle commentedIn the mean time, you can work around this by making sure
$edit['mail']
is set to anything, even an empty string.Comment #7
dawehnerComment #8
Dries CreditAttribution: Dries commentedThis patch does not apply against D8. Will need some work.
Comment #9
bfroehle CreditAttribution: bfroehle commentedRerolled for D8. Set to RTBC if the tests pass.
Comment #10
bfroehle CreditAttribution: bfroehle commentedJust marked #1126126: trim() causes error with empty mailadresses in user.module as a duplicate which suggested the same patch.
Comment #11
Dries CreditAttribution: Dries commentedThanks for the re-roll. Committed to 8.x.
I'll let @webchick commit this fix to 7.x. Moving version.
Comment #12
webchickCommitted to 7.x to get 8.x and 7.x in sync.
However. Tests?
Comment #13
pillarsdotnet CreditAttribution: pillarsdotnet commentedComment #14
dawehnerIt seems to be not required at all anymore for d8? User is not a proper object without the $edit parameter etc.
Comment #28
quietone CreditAttribution: quietone as a volunteer commentedI think that #14 is right and that this is no longer relevant for Drupal 8/9. So, changing to Drupal 7.