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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Stevel’s picture

Status: Active » Needs review
FileSize
708 bytes

Patch added

Status: Needs review » Needs work

The last submitted patch, 817482-user-save-without-mail.patch, failed testing.

Stevel’s picture

Status: Needs work » Needs review
FileSize
708 bytes

Reroll for latest HEAD

Stevel’s picture

rediff from drupal root directory

Jelle_S’s picture

Status: Needs review » Reviewed & tested by the community

this patch solves the error described in the issue

bfroehle’s picture

In the mean time, you can work around this by making sure $edit['mail'] is set to anything, even an empty string.

dawehner’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
Dries’s picture

Status: Reviewed & tested by the community » Needs work

This patch does not apply against D8. Will need some work.

bfroehle’s picture

Status: Needs work » Needs review
FileSize
1023 bytes

Rerolled for D8. Set to RTBC if the tests pass.

bfroehle’s picture

Status: Needs review » Reviewed & tested by the community

Just marked #1126126: trim() causes error with empty mailadresses in user.module as a duplicate which suggested the same patch.

Dries’s picture

Version: 8.x-dev » 7.x-dev

Thanks for the re-roll. Committed to 8.x.

I'll let @webchick commit this fix to 7.x. Moving version.

webchick’s picture

Version: 7.x-dev » 8.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Committed to 7.x to get 8.x and 7.x in sync.

However. Tests?

pillarsdotnet’s picture

dawehner’s picture

It seems to be not required at all anymore for d8? User is not a proper object without the $edit parameter etc.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • Dries committed 54001ae on 8.3.x
    - Patch #817482 by Stevel, bfroehle: user_save() issues a warning when...

  • Dries committed 54001ae on 8.3.x
    - Patch #817482 by Stevel, bfroehle: user_save() issues a warning when...

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

  • Dries committed 54001ae on 8.4.x
    - Patch #817482 by Stevel, bfroehle: user_save() issues a warning when...

  • Dries committed 54001ae on 8.4.x
    - Patch #817482 by Stevel, bfroehle: user_save() issues a warning when...

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

  • Dries committed 54001ae on 9.1.x
    - Patch #817482 by Stevel, bfroehle: user_save() issues a warning when...

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 7.x-dev
Issue summary: View changes
Issue tags: -Needs backport to D7 +Bug Smash Initiative

I think that #14 is right and that this is no longer relevant for Drupal 8/9. So, changing to Drupal 7.