From ec529b770450277cfe9b0a03446b746fa85eb9ca Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Mon, 23 Dec 2019 12:51:43 -0500 Subject: [PATCH] [#2893] - Restructured logger to use DateTimeImmutable to handle microseconds --- phalcon/Logger/Formatter/AbstractFormatter.zep | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phalcon/Logger/Formatter/AbstractFormatter.zep b/phalcon/Logger/Formatter/AbstractFormatter.zep index 0ce2f06516d..0ee64665c05 100644 --- a/phalcon/Logger/Formatter/AbstractFormatter.zep +++ b/phalcon/Logger/Formatter/AbstractFormatter.zep @@ -58,8 +58,13 @@ abstract class AbstractFormatter implements FormatterInterface { var date, timezone; - let timezone = date_default_timezone_get(), - date = new DateTimeImmutable("now", new DateTimeZone(timezone)); + let timezone = date_default_timezone_get(); + + if !timezone { + let timezone = "UTC"; + } + + let date = new DateTimeImmutable("now", new DateTimeZone(timezone)); return date->format(this->dateFormat); }