From 94e74bf0f8ae82a28c70fe1a3cb76a01f6c50fd8 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 16 May 2012 17:20:56 +0100 Subject: If we want E_STRICT, don't suppress it! 15be8fc "Changed the 'development' environment default error reporting to included E_STRICT" Not present in any tagged release, so no need for -stable or a changlelog entry. --- system/core/Common.php | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 78aa6e874..ec94c528b 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -487,16 +487,6 @@ if ( ! function_exists('_exception_handler')) */ function _exception_handler($severity, $message, $filepath, $line) { - // We don't bother with "strict" notices since they tend to fill up - // the log file with excess information that isn't normally very helpful. - // For example, if you are running PHP 5 and you use version 4 style - // class functions (without prefixes like "public", "private", etc.) - // you'll get notices telling you that these have been deprecated. - if ($severity == E_STRICT) - { - return; - } - $_error =& load_class('Exceptions', 'core'); // Should we display the error? We'll get the current error_reporting -- cgit v1.2.3-24-g4f1b From 92ebfb65ac044f5c2e6d88fba137253854cf1b94 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 12:49:24 +0300 Subject: Cleanup the core classes --- system/core/Common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 78aa6e874..8b897776f 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -31,7 +31,7 @@ * Loads the base classes and executes the request. * * @package CodeIgniter - * @subpackage codeigniter + * @subpackage CodeIgniter * @category Common Functions * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/ @@ -57,7 +57,7 @@ if ( ! function_exists('is_php')) if ( ! isset($_is_php[$version])) { - $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE; + $_is_php[$version] = (version_compare(PHP_VERSION, $version) >= 0); } return $_is_php[$version]; @@ -506,7 +506,7 @@ if ( ! function_exists('_exception_handler')) $_error->show_php_error($severity, $message, $filepath, $line); } - // Should we log the error? No? We're done... + // Should we log the error? No? We're done... if (config_item('log_threshold') == 0) { return; -- cgit v1.2.3-24-g4f1b From b6e0b588522055ddffc44e63e5479309fa3b4b14 Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Mon, 14 May 2012 21:31:04 +0300 Subject: Load base config first, then environment's config --- system/core/Common.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 4b733ac97..f468747c6 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -231,21 +231,21 @@ if ( ! function_exists('get_config')) return $_config[0]; } - // Is the config file in the environment folder? - if ( ! defined('ENVIRONMENT') OR ! file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) - { - $file_path = APPPATH.'config/config.php'; + $file_path = APPPATH.'config/config.php'; + $found = false; + if (file_exists($file_path)) { + $found = true; + require($file_path); } - // Fetch the config file - if ( ! file_exists($file_path)) + // Is the config file in the environment folder? + if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { - set_status_header(503); + require($file_path); + } else if (!$found) { exit('The configuration file does not exist.'); } - require($file_path); - // Does the $config array exist in the file? if ( ! isset($config) OR ! is_array($config)) { -- cgit v1.2.3-24-g4f1b From 8991cb85b9d9955270bdbbd96a08ba9141c5e11d Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Sun, 20 May 2012 18:44:21 +0300 Subject: Indended code to meet CI standards --- system/core/Common.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index f468747c6..8ed18cdae 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -233,7 +233,8 @@ if ( ! function_exists('get_config')) $file_path = APPPATH.'config/config.php'; $found = false; - if (file_exists($file_path)) { + if (file_exists($file_path)) + { $found = true; require($file_path); } @@ -242,7 +243,10 @@ if ( ! function_exists('get_config')) if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { require($file_path); - } else if (!$found) { + } + else if (!$found) + { + set_status_header(503); exit('The configuration file does not exist.'); } -- cgit v1.2.3-24-g4f1b From 142eef9c0024420fdc1442eafe8e5cdd357451bb Mon Sep 17 00:00:00 2001 From: Thanasis Polychronakis Date: Mon, 21 May 2012 14:38:22 +0300 Subject: Edit to meet CI coding standards --- system/core/Common.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 8ed18cdae..159cc0d2b 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -232,10 +232,10 @@ if ( ! function_exists('get_config')) } $file_path = APPPATH.'config/config.php'; - $found = false; + $found = FALSE; if (file_exists($file_path)) { - $found = true; + $found = TRUE; require($file_path); } @@ -244,7 +244,7 @@ if ( ! function_exists('get_config')) { require($file_path); } - else if (!$found) + elseif ( ! $found) { set_status_header(503); exit('The configuration file does not exist.'); -- cgit v1.2.3-24-g4f1b From ed944a3c70a0bad158cd5a6ca5ce1f2e717aff5d Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:07:47 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/core --- system/core/Common.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 159cc0d2b..a773c4f20 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -200,7 +200,7 @@ if ( ! function_exists('is_loaded')) { static $_is_loaded = array(); - if ($class != '') + if ($class !== '') { $_is_loaded[strtolower($class)] = $class; } @@ -370,7 +370,7 @@ if ( ! function_exists('log_message')) { static $_log; - if (config_item('log_threshold') == 0) + if (config_item('log_threshold') === 0) { return; } @@ -436,17 +436,17 @@ if ( ! function_exists('set_status_header')) 505 => 'HTTP Version Not Supported' ); - if ($code == '' OR ! is_numeric($code)) + if ($code === '' OR ! is_numeric($code)) { show_error('Status codes must be numeric', 500); } - if (isset($stati[$code]) && $text == '') + if (isset($stati[$code]) && $text === '') { $text = $stati[$code]; } - if ($text == '') + if ($text === '') { show_error('No status text available. Please check your status code number or supply your own message text.', 500); } @@ -495,13 +495,13 @@ if ( ! function_exists('_exception_handler')) // Should we display the error? We'll get the current error_reporting // level and add its bits with the severity bits to find out. - if (($severity & error_reporting()) == $severity) + if (($severity & error_reporting()) === $severity) { $_error->show_php_error($severity, $message, $filepath, $line); } // Should we log the error? No? We're done... - if (config_item('log_threshold') == 0) + if (config_item('log_threshold') === 0) { return; } -- cgit v1.2.3-24-g4f1b From 9ba661b02c492e89028e5c67b7edbfc0efefc9f1 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 Jun 2012 14:44:34 +0300 Subject: Revert/optimize some changes from ed944a3c70a0bad158cd5a6ca5ce1f2e717aff5d --- system/core/Common.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index a773c4f20..8af7d6323 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -436,12 +436,11 @@ if ( ! function_exists('set_status_header')) 505 => 'HTTP Version Not Supported' ); - if ($code === '' OR ! is_numeric($code)) + if ($code == '' OR ! is_numeric($code)) { show_error('Status codes must be numeric', 500); } - - if (isset($stati[$code]) && $text === '') + elseif (isset($stati[$code]) && $text === '') { $text = $stati[$code]; } -- cgit v1.2.3-24-g4f1b From 6ef498b49946ba74d610b3805fb908b163a7f03a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 5 Jun 2012 22:01:58 +0300 Subject: Added get_mimes() function to system/core/Commons.php.The MIMEs array from config/mimes.php is used by multiple core classes, libraries and helpers and each of them has implemented an own way of getting it, which is not needed and is hard to maintain. This also fixes issue #1411 --- system/core/Common.php | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 8af7d6323..5e3b8262d 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -233,7 +233,7 @@ if ( ! function_exists('get_config')) $file_path = APPPATH.'config/config.php'; $found = FALSE; - if (file_exists($file_path)) + if (file_exists($file_path)) { $found = TRUE; require($file_path); @@ -242,9 +242,9 @@ if ( ! function_exists('get_config')) // Is the config file in the environment folder? if (defined(ENVIRONMENT) && file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) { - require($file_path); - } - elseif ( ! $found) + require($file_path); + } + elseif ( ! $found) { set_status_header(503); exit('The configuration file does not exist.'); @@ -304,6 +304,32 @@ if ( ! function_exists('config_item')) // ------------------------------------------------------------------------ +if ( ! function_exists('get_mimes')) +{ + /** + * Returns the MIME types array from config/mimes.php + * + * @return array + */ + function &get_mimes() + { + static $_mimes = array(); + + if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + { + $_mimes = include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); + } + elseif (is_file(APPPATH.'config/mimes.php')) + { + $_mimes = include(APPPATH.'config/mimes.php'); + } + + return $_mimes; + } +} + +// ------------------------------------------------------------------------ + if ( ! function_exists('show_error')) { /** -- cgit v1.2.3-24-g4f1b From 24bd230337cc469941dbdb51e05351cc1b3fbe14 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 5 Jun 2012 22:29:12 +0300 Subject: Fix a magic_quotes-related bug and changed the default parameter value for is_php() --- system/core/Common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 5e3b8262d..c08755c91 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -44,13 +44,13 @@ if ( ! function_exists('is_php')) /** * Determines if the current version of PHP is greater then the supplied value * - * Since there are a few places where we conditionally test for PHP > 5 + * Since there are a few places where we conditionally test for PHP > 5.3 * we'll set a static variable. * * @param string * @return bool TRUE if the current version is $version or higher */ - function is_php($version = '5.0.0') + function is_php($version = '5.3.0') { static $_is_php; $version = (string) $version; -- cgit v1.2.3-24-g4f1b