From c22a521df1ce4d4600059ff8412762925f62af33 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 14 Sep 2012 02:33:37 -0400
Subject: [PATCH] Move date.timezone check to 'required' block, add date.timezone value validation

---
 installer/check.php |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/installer/check.php b/installer/check.php
index 52460bb..cf96d8d 100644
--- a/installer/check.php
+++ b/installer/check.php
@@ -35,12 +35,12 @@
     'suhosin.session.encrypt'       => 0,
     'magic_quotes_runtime'          => 0,
     'magic_quotes_sybase'           => 0,
+    'date.timezone'                 => '-NOTEMPTY-',
 );
 
 $optional_checks = array(
     // required for utils/modcss.inc, should we require this?
     'allow_url_fopen'  => 1,
-    'date.timezone'    => '-NOTEMPTY-',
 );
 
 $source_urls = array(
@@ -171,7 +171,15 @@
     $status = ini_get($var);
     if ($val === '-NOTEMPTY-') {
         if (empty($status)) {
-            $RCI->fail($var, "cannot be empty and needs to be set");
+            $RCI->fail($var, "empty value detected");
+        } else if ($var == 'date.timezone') {
+            try {
+                $tz = new DateTimeZone($status);
+                $RCI->pass($var);
+            }
+            catch (Exception $e) {
+                $RCI->fail($var, "invalid value detected");
+            }
         } else {
             $RCI->pass($var);
         }

--
Gitblit v1.9.1