[wp-trac] [WordPress Trac] #25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names
WordPress Trac
noreply at wordpress.org
Fri Oct 14 21:20:43 UTC 2016
#25239: $_SERVER['SERVER_NAME'] not a reliable when generating email host names
-------------------------------------------------+-------------------------
Reporter: layotte | Owner:
Type: defect (bug) | SergeyBiryukov
Priority: normal | Status: reviewing
Component: Mail | Milestone: Future
Severity: normal | Release
Keywords: has-patch dev-feedback needs- | Version: 3.8
testing | Resolution:
| Focuses:
-------------------------------------------------+-------------------------
Comment (by joemcgill):
@Ipstenu thanks for pointing out that those are for the `From:` emails.
Even so, your point about "leave it alone" stands, so I wonder if we
should only use `home_url()` here as a fallback whenever
`$_SERVER['SERVER_NAME']` isn't set—which is the reason for this ticket in
the first place.
@mensmaximus Thanks for the reminder about your approach. If I understand
your thinking, making this function more flexible would also allow it to
be used instead of `$_SERVER['HTTP_HOST']` as well, correct? If so, I
worry about there becoming overlap/confusion between this function and
already existing functions, like `get_site_url()`, `get_home_url()`, etc.
Is there a needed use case for a function that does any more than checks
to see if `$_SERVER['SERVER_NAME']` is set, and if not, returns
`home_url()` (with a `www` subdomain stripped, if applicable)? If not, it
may be better to keep the scope of this narrowly defined as a wrapper
around `$_SERVER['SERVER_NAME']` and to reinforce its purpose in the
function name—so maybe something like `wp_server_name()` or
`get_server_name()` instead.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25239#comment:51>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list