diff --git a/plugins/FeedsParser.inc b/plugins/FeedsParser.inc index 1132620321c52818fd821f1201e3840787d44d71..c864f291738cf0967ad0938a77a0877c22173151 100644 --- a/plugins/FeedsParser.inc +++ b/plugins/FeedsParser.inc @@ -610,7 +610,7 @@ class FeedsDateTime extends DateTime { $time = str_replace("GMT+", "+", $time); // Some PHP 5.2 version's DateTime class chokes on invalid dates. - if (!strtotime($time)) { + if (!date_create($time)) { $time = 'now'; } diff --git a/tests/feeds_date_time.test b/tests/feeds_date_time.test index 8ced8438cc2fc21290310e55af4663a2f83b751d..989179dfdcb4c7a37d0cc5e21cfcdead783172d9 100644 --- a/tests/feeds_date_time.test +++ b/tests/feeds_date_time.test @@ -43,6 +43,11 @@ class FeedsDateTimeTest extends FeedsWebTestCase { $date1 = new FeedsDateTime(2012); $date2 = new FeedsDateTime('January 2012'); $this->assertEqual($date1->format('U'), $date2->format('U')); + + // Check that years before 1902 work correctly. + $early_date_string = '01/02/1901'; + $date = new FeedsDateTime($early_date_string); + $this->assertEqual($date->format('m/d/Y'), $early_date_string); } }