From f2f220c7158fca98b9d136c53d890f63aca2f4f9 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 14 Jan 2021 15:07:44 +0100 Subject: [PATCH] Timestamp: Properly handle non-convertible text --- library/Icingadb/Model/Behavior/Timestamp.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/Icingadb/Model/Behavior/Timestamp.php b/library/Icingadb/Model/Behavior/Timestamp.php index 3a624d5d..b29b3d62 100644 --- a/library/Icingadb/Model/Behavior/Timestamp.php +++ b/library/Icingadb/Model/Behavior/Timestamp.php @@ -24,7 +24,12 @@ class Timestamp extends PropertyBehavior } if (! ctype_digit($value)) { - $value = strtotime($value); + $timestamp = strtotime($value); + if ($timestamp === false) { + return $value; + } else { + $value = $timestamp; + } } return $value * 1000.0;