[wp-trac] [WordPress Trac] #40390: Wrong time (and date) in mail header send by phpmailer
WordPress Trac
noreply at wordpress.org
Tue May 2 11:47:44 UTC 2017
#40390: Wrong time (and date) in mail header send by phpmailer
--------------------------+------------------------------
Reporter: Drivingralle | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version: 4.7.3
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by Rarst):
Note that `current_time()` itself calls `date()` and assumes default
timezone. In other words it will ignore WP time zone and output completely
invalid stuff unless `gmt` arg is set to true.
{{{#!php
<?php
var_dump( date_default_timezone_get() );
// "UTC"
var_dump( date('D, j M Y H:i:s O') );
// "Tue, 2 May 2017 11:38:08 +0000" << correct UTC
var_dump( current_time( 'D, j M Y H:i:s O' ) );
// "Tue, 2 May 2017 14:38:08 +0000" << local time, invalid time zone
var_dump( current_time( 'D, j M Y H:i:s O', true ) );
// "Tue, 2 May 2017 11:38:08 +0000" << correct UTC
}}}
So your last suggestion to use `current_time()` will just increase
breakage. :(
I am not sure why would times be "wrong" without more context. If `date()`
without input is used they would be ''correct'', just always in UTC (which
consuming email clients should be able to display in desired time zone I
would assume).
The more likely issue is that WP API is feeding broken input into mailer
class.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40390#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list