From 637b58c7c83af4753e373d2e8bff23a155c69032 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 26 Jul 2016 07:06:25 -0700 Subject: [PATCH] Correct an issue with epoch timestamps in Conduit Summary: Fixes T11375. Some validation code was mishandling raw epoch timestamps. For numeric values larger than 29999999 (e.g., 2999-12-25, christmas 2999), assume the value is a timestamp. Test Plan: Used `maniphest.search` to query for `modifiedStart`, got a better result set and saw the `dateModified` constraint in the query. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11375 Differential Revision: https://secure.phabricator.com/D16326 --- .../search/field/PhabricatorSearchDateField.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/applications/search/field/PhabricatorSearchDateField.php b/src/applications/search/field/PhabricatorSearchDateField.php index 84b7e2580a..21b1627de7 100644 --- a/src/applications/search/field/PhabricatorSearchDateField.php +++ b/src/applications/search/field/PhabricatorSearchDateField.php @@ -35,6 +35,14 @@ final class PhabricatorSearchDateField return null; } + // If this appears to be an epoch timestamp, just return it unmodified. + // This assumes values like "2016" or "20160101" are "Ymd". + if (is_int($value) || ctype_digit($value)) { + if ((int)$value > 30000000) { + return (int)$value; + } + } + return PhabricatorTime::parseLocalTime($value, $this->getViewer()); }