Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#44569 closed defect (bug) (duplicate)

SERVER_NAME undefined index in WP CLI

Reported by: displaynone's profile displaynone Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.7
Component: Mail Keywords:
Focuses: Cc:


When updating a user using wp cli I get this notice:

wp user update admin --user_pass=password
Notice: Undefined index: SERVER_NAME in /wp-includes/pluggable.php on line 330

Change History (2)

#1 @displaynone
6 years ago

  • Version set to 4.9.7

#2 @swissspidy
6 years ago

  • Component changed from General to Mail
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed


That line comes from wp_mail(), which is known to have issues with using $_SERVER['SERVER_NAME']. See #25239.

I'm therefore closing this ticket as a duplicate, because to really solve this, we'd have to stop using that variable. That ticket proposes exactly this.

You can prevent this from happening by explicitly setting the site URL in your wp-cli.yml configuration: or perhaps by setting $_SERVER['SERVER_NAME'] in your wp-config.php in case it's not set (which is the case when using CLI)

See also the WP-CLI FAQ entry on that matter:

Note: See TracTickets for help on using tickets.