Changeset:
        896e7b8ee1a8
        
https://sourceforge.net/p/mrbs/hg-code/ci/896e7b8ee1a8a21db98e0479b456182a16994091
Author:
        Campbell Morrison <[email protected]>
Date:
        Thu Oct 20 15:20:31 2016 +0100
Log message:

Ensured that the timezone is set before trying to output an error message, 
otherwise further error messages are produced.

diffstat:

 web/functions_error.inc |  12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r 8e4ed8a49b50 -r 896e7b8ee1a8 web/functions_error.inc
--- a/web/functions_error.inc   Tue Oct 18 17:20:51 2016 +0100
+++ b/web/functions_error.inc   Thu Oct 20 15:20:31 2016 +0100
@@ -31,6 +31,18 @@
 
 function output_error($heading, $body, $show_data=false)
 {
+  static $date_default_timezone_set = false;
+  
+  // We can't start outputting any error messages unless the default timezone 
has been set,
+  // so if we are not sure that it has been set, then set it.
+  if (!$date_default_timezone_set)
+  {
+    // For some reason date_default_timezone_get() will produce an error 
message if
+    // date_default_timezone_set() hasn't already been called, so suppress any 
errors.
+    date_default_timezone_set(@date_default_timezone_get());
+    $date_default_timezone_set = true;
+  }
+  
   if ($show_data)
   {
       if (isset($_GET))

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to