From bf2b912ec37cde3bb809437c0763bac860665915 Mon Sep 17 00:00:00 2001 From: joelcox Date: Sun, 16 Jan 2011 15:24:43 +0100 Subject: Removed default error_reporting and set it depending on environment --- index.php | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/index.php b/index.php index 7eacaab63..016ffc015 100644 --- a/index.php +++ b/index.php @@ -6,24 +6,14 @@ *--------------------------------------------------------------- * * You can load different configurations depending on your - * current environment. The enviroment variable can be set - * to "development" (default), "test" or "production" + * current environment. Setting the environment also influences + * things like logging and error reporting. The enviroment + * variable can be set to "development" (default), + * "test" or "production". * */ define('ENVIRONMENT', 'development'); -/* - *--------------------------------------------------------------- - * PHP ERROR REPORTING LEVEL - *--------------------------------------------------------------- - * - * By default CI runs with error reporting set to ALL. For security - * reasons you are encouraged to change this to 0 when your site goes live. - * For more info visit: http://www.php.net/error_reporting - * - */ - error_reporting(E_ALL); - /* *--------------------------------------------------------------- * SYSTEM FOLDER NAME @@ -106,9 +96,25 @@ // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE // -------------------------------------------------------------------- +/* + * --------------------------------------------------------------- + * Check if environment is set, and set error reporting appropriately + * --------------------------------------------------------------- + */ - - + if (ENVIRONMENT == 'development') + { + error_reporting(E_ALL); + } + elseif (ENVIRONMENT == 'production' OR ENVIRONMENT == 'test') + { + error_reporting(0); + } + else + { + exit("The application environment is not set correctly."); + } + /* * --------------------------------------------------------------- * Resolve the system path for increased reliability -- cgit v1.2.3-24-g4f1b