diff --git a/library/Icinga/Util/Format.php b/library/Icinga/Util/Format.php index 756763028..46ccdadc4 100644 --- a/library/Icinga/Util/Format.php +++ b/library/Icinga/Util/Format.php @@ -29,6 +29,8 @@ namespace Icinga\Util; +use Icinga\Exception\ProgrammingError; + class Format { const STANDARD_IEC = 0; @@ -99,6 +101,9 @@ class Format if (! $timestamp) { return '-'; } + if (! preg_match('~^\d+$~', $timestamp)) { + throw new ProgrammingError(sprintf('"%s" is not a number', $timestamp)); + } $duration = time() - $timestamp; $prefix = ''; if ($duration < 0) {