WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#44569 closed defect (bug) (duplicate)

SERVER_NAME undefined index in WP CLI

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

Description

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
2 years ago

  • Version set to 4.9.7

#2 @swissspidy
2 years ago

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

Howdy!

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: https://make.wordpress.org/cli/handbook/config/ 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: https://make.wordpress.org/cli/handbook/common-issues/#php-notice-undefined-index-on-_server-superglobal

Note: See TracTickets for help on using tickets.