From 84371887a91c28bc1d394df2a80a8770a136d716 Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Fri, 4 Mar 2016 14:23:48 +0100 Subject: [PATCH] No need to disable the error handler momentarily when guessing the timezone from the OS. Mask errors instead. --- lib/SimpleSAML/Utils/Time.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/SimpleSAML/Utils/Time.php b/lib/SimpleSAML/Utils/Time.php index bbbcb8ca2..66d8a4e30 100644 --- a/lib/SimpleSAML/Utils/Time.php +++ b/lib/SimpleSAML/Utils/Time.php @@ -7,6 +7,8 @@ namespace SimpleSAML\Utils; +use SimpleSAML\Logger; + class Time { @@ -56,17 +58,9 @@ class Time } // we don't have a timezone configured - /* - * The date_default_timezone_get() function is likely to cause a warning. - * Since we have a custom error handler which logs the errors with a backtrace, - * this error will be logged even if we prefix the function call with '@'. - * Instead we temporarily replace the error handler. - */ - set_error_handler(function () { - return true; - }); + Logger::maskErrors(E_ALL); $serverTimezone = date_default_timezone_get(); - restore_error_handler(); + Logger::popErrorMask(); // set the timezone to the default date_default_timezone_set($serverTimezone); -- GitLab