class-phpmailer.php rfcDate() not returning proper adjusted timestamp
-
We use WP for all of our web development for clients, and while not every client needs Emails to be sent from within wp, our own websites do. The issue we have had has to do with the outgoing Email header not having the proper tz adjusted time and offset added to the outgoing Emails. This is important for a lot of reasons that I won’t go into here, but it is something that seems to be of issue with ALL wp installations.
This core function is also used by plugins sending Email which means that other software running under WP may not work properly.
NOTICE in the date format function, the timezone offset is hard coded to ‘0’ in the original code. This is a dead give away that no one else has looked at this.
What is really troubling me is that I’m the only one who has identified this issue and addressed it. Can the wp team correct whatever isn’t working properly or coded properly so that this doesn’t have to be a hack?
We came up with this hack, which we have implemented manually on our hosted websites and it’s working great.
The issue is in /wp-includes/class-phpmailer.php in the function rfcDate()
/** * Return an RFC 822 formatted date. * @access public * @return string * @static */ public static function rfcDate() { //Set the time zone to whatever the default is to avoid 500 errors //Will default to UTC if it's not set properly in php.ini //Code in the distribution //date_default_timezone_set(@date_default_timezone_get()); //return date('D, j M Y H:i:s 0'); //Fix - Hard coded hack in our hosted installations date_default_timezone_set('US/Central'); return date('D, j M Y H:i:s -0500'); }
I want to point out that we have verified system timezone settings and have played with the php.ini by changing the timezone by hard coding it to something other than UTC / GMT – regardless, this function returns the exact same time and offset.
- The topic ‘class-phpmailer.php rfcDate() not returning proper adjusted timestamp’ is closed to new replies.