Opened 6 years ago
Closed 6 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: | 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)
Note: See
TracTickets for help on using
tickets.
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 yourwp-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