WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #37945


Ignore:
Timestamp:
09/05/2016 11:48:17 AM (4 years ago)
Author:
ocean90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37945 – Description

    initial v1  
    1 In some WordPress server setups the $_SERVER['SERVER_NAME'] may not have been setup, so $_SERVER['SERVER_NAME'] is empty.
     1In some WordPress server setups the `$_SERVER['SERVER_NAME']` may not have been setup, so `$_SERVER['SERVER_NAME']` is empty.
    22
    33For example Nginx (see http://nginx.org/en/docs/http/server_names.html) will set the server name to empty if none is set in the configuration, but afaik it is also possible for Apache to set the ServerName to an empty string.
     
    55If the from_email address is *also* NOT set this will cause PHPMailer to throw an exception complaining about an invalid address. This will cause an infamous white screen. 
    66
    7 In https://core.trac.wordpress.org/ticket/32702 this was also mentioned but @boonebgorges thought the test was to blame and fixed the test, but IMHO the test was correct and the code should be fixed.
     7In #32702 this was also mentioned but @boonebgorges thought the test was to blame and fixed the test, but IMHO the test was correct and the code should be fixed.
    88
    99We need to check if the SERVER_NAME is empty or not. I've attached a patch in which I check to make sure SERVER_NAME is not empty and if it is empty it will resort to using the admin_email address instead. At least this mail address should be valid, although it might still fail to deliver the email sent due to using a different domain than the server WordPress is installed on.
    1010
    11 A much better option might be to allow the user to choose the from email address, but apparently this has been considered and at that moment considered a bad idea, see https://core.trac.wordpress.org/ticket/23365
     11A much better option might be to allow the user to choose the from email address, but apparently this has been considered and at that moment considered a bad idea, see #23365.