cast timestamps older than unix epoch to 0

This change solves issues #10870, which is caused by method castValue of class FileSearchBackend: It casts the timestamps older than the unix epoch to false., see my comment https://github.com/nextcloud/server/pull/10835#discussion_r212806153.
This commit is contained in:
Christian 2018-08-27 07:44:24 +02:00 committed by GitHub
parent 8b47f45afa
commit e2a64c713f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -355,7 +355,7 @@ class FileSearchBackend implements ISearchBackend {
return max(0, 0 + $value);
}
$date = \DateTime::createFromFormat(\DateTime::ATOM, $value);
return ($date instanceof \DateTime) ? $date->getTimestamp() : 0;
return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0;
default:
return $value;
}