diff options
author | Robin Appelman <robin@icewind.nl> | 2017-03-14 14:12:40 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-03-14 14:12:40 +0100 |
commit | e392d02d80fb347a93e57edf009c1f3ef3549415 (patch) | |
tree | 1b14895c8ca6adb8ba936b7f3c73adb35217da4c /apps/dav/lib/Files/FileSearchBackend.php | |
parent | ef14dc671f540419a044d353036763a02fe68d58 (diff) | |
download | nextcloud-server-e392d02d80fb347a93e57edf009c1f3ef3549415.tar.gz nextcloud-server-e392d02d80fb347a93e57edf009c1f3ef3549415.zip |
safer casting of datetime
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dav/lib/Files/FileSearchBackend.php')
-rw-r--r-- | apps/dav/lib/Files/FileSearchBackend.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/dav/lib/Files/FileSearchBackend.php b/apps/dav/lib/Files/FileSearchBackend.php index 784047ad255..5816c659932 100644 --- a/apps/dav/lib/Files/FileSearchBackend.php +++ b/apps/dav/lib/Files/FileSearchBackend.php @@ -262,7 +262,11 @@ class FileSearchBackend implements ISearchBackend { case SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER: return 0 + $value; case SearchPropertyDefinition::DATATYPE_DATETIME: - return \DateTime::createFromFormat(\DateTime::ATOM, $value)->getTimestamp(); + if (is_numeric($value)) { + return 0 + $value; + } + $date = \DateTime::createFromFormat(\DateTime::ATOM, $value); + return ($date instanceof \DateTime) ? $date->getTimestamp() : 0; default: return $value; } |