From f2eafda5393280c6479fcbc156f0c4fddc906787 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 12 Jun 2016 09:16:54 +0200 Subject: [PATCH] Fix bug where microsecond format in logged date didn't work in some cases --- CHANGELOG | 1 + program/lib/Roundcube/rcube_utils.php | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 121b2a865..f22d9f01a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,7 @@ CHANGELOG Roundcube Webmail - Workaround PHP issue by calling closelog() on script shutdown when using log_driver=syslog (#5289) - Fix so upgrade script makes sure program/lib directory does not contain old libraries (#5287) - Fix subscription checkbox state on error in folder subscribe/unsubscribe action (#5243) +- Fix bug where microsecond format in logged date didn't work in some cases RELEASE 1.2.0 ------------- diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index 67421f1c9..0aae68ad9 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -1208,10 +1208,13 @@ class rcube_utils $format = 'd-M-Y H:i:s O'; } - if (strpos($format, 'u') !== false - && ($date = date_create_from_format('U.u.e', microtime(true) . '.' . date_default_timezone_get())) - ) { - return $date->format($format); + if (strpos($format, 'u') !== false) { + $dt = number_format(microtime(true), 6, '.', ''); + $dt .= '.' . date_default_timezone_get(); + + if ($date = date_create_from_format('U.u.e', $dt)) { + return $date->format($format); + } } return date($format);