diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d6a2d6c6c47c969b539bd52e778a789865ea715c..63de8a104773f95bf2bb9189b36956354113aae6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ Feeds 6.x 1.0 XXXXXXXXXXXXXXXXXX -------------------------------- +- #901798 alex_b: Fix time off in SitemapParser. - #885724 eliotttf: Avoid array_flip() on non scalars. - #885052 Hanno: Fix small typo in access rights. - #863494 ekes, alex_b: Delete temporary enclosures file. diff --git a/plugins/FeedsSitemapParser.inc b/plugins/FeedsSitemapParser.inc index b0180a57837c6783d91eaa0f1f567941333a59e9..7472dc40a4dfadd0352ff5cfee6ef8526c920274 100644 --- a/plugins/FeedsSitemapParser.inc +++ b/plugins/FeedsSitemapParser.inc @@ -9,6 +9,9 @@ class FeedsSitemapParser extends FeedsParser { * Implementation of FeedsParser::parse(). */ public function parse(FeedsImportBatch $batch, FeedsSource $source) { + // Set time zone to GMT for parsing dates with strtotime(). + $tz = date_default_timezone_get(); + date_default_timezone_set('GMT'); // Yes, using a DOM parser is a bit inefficient, but will do for now $xml = new SimpleXMLElement($batch->getRaw()); foreach ($xml->url as $url) { @@ -24,6 +27,7 @@ class FeedsSitemapParser extends FeedsParser { } $batch->addItem($item); } + date_default_timezone_set($tz); } /** diff --git a/tests/feeds.test b/tests/feeds.test index 608307b4b962febde8d5a11113edc666d417a9a0..19424967eeda5d9be661e49507d01791654040fe 100644 --- a/tests/feeds.test +++ b/tests/feeds.test @@ -982,6 +982,7 @@ class FeedsSitemapParserTestCase extends FeedsWebTestCase { $result = db_query('SELECT * FROM {feeds_node_item} WHERE feed_nid = %d ORDER BY nid', $nid); // Check first item. + date_default_timezone_set('GMT'); $item = db_fetch_object($result); $node = node_load($item->nid); $this->assertEqual($node->title, 'monthly', 'Feed item 1 changefreq is correct.');