From f288fbccb8aadfb666db7bb23e928164f6876962 Mon Sep 17 00:00:00 2001
From: Chris Leppanen <chris.leppanen@gmail.com>
Date: Fri, 19 Apr 2013 02:15:30 -0700
Subject: [PATCH] Issue #630288 by kulfi: Added import date compatibility
 issues with Google Groups' feeds.

---
 libraries/common_syndication_parser.inc | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/libraries/common_syndication_parser.inc b/libraries/common_syndication_parser.inc
index 19cc7868..95899509 100644
--- a/libraries/common_syndication_parser.inc
+++ b/libraries/common_syndication_parser.inc
@@ -497,12 +497,25 @@ function _parser_common_syndication_RSS20_parse($feed_XML) {
  */
 function _parser_common_syndication_parse_date($date_str) {
   // PHP < 5.3 doesn't like the GMT- notation for parsing timezones.
-  $date_str = str_replace("GMT-", "-", $date_str);
-  $date_str = str_replace("GMT+", "+", $date_str);
+  $date_str = str_replace('GMT-', '-', $date_str);
+  $date_str = str_replace('GMT+', '+', $date_str);
   $parsed_date = strtotime($date_str);
+
   if ($parsed_date === FALSE || $parsed_date == -1) {
     $parsed_date = _parser_common_syndication_parse_w3cdtf($date_str);
   }
+
+  if (($parsed_date === FALSE || $parsed_date == -1)) {
+    // PHP does not support the UT timezone. Fake it. The system that generated
+    // this, Google Groups, probably meant UTC.
+    $date_str = strtolower(trim($date_str));
+    $last_three = substr($date_str, strlen($date_str) - 3, 3);
+
+    if ($last_three == ' ut') {
+      $parsed_date = strtotime($date_str . 'c');
+    }
+  }
+
   return $parsed_date === FALSE ? time() : $parsed_date;
 }
 
-- 
GitLab