From 61b12ab4d799fe84096481d6b6a18a23bc2eb0d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Tue, 17 Dec 2013 21:42:22 -0500 Subject: [PATCH] Bug fix date parsing (thanks to @skasi7) --- vendor/PicoFeed/Parser.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vendor/PicoFeed/Parser.php b/vendor/PicoFeed/Parser.php index 8e8d89f..97c34e0 100644 --- a/vendor/PicoFeed/Parser.php +++ b/vendor/PicoFeed/Parser.php @@ -140,8 +140,16 @@ abstract class Parser $value = trim($value); foreach ($formats as $format => $length) { - $timestamp = $this->getValidDate($format, substr($value, 0, $length)); - if ($timestamp > 0) return $timestamp; + + $truncated_value = $value; + if ($length !== null) { + $truncated_value = substr($truncated_value, 0, $length); + } + + $timestamp = $this->getValidDate($format, $truncated_value); + if ($timestamp > 0) { + return $timestamp; + } } return time();