summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-10-05 23:00:08 +0200
committerAndrey Andreev <narf@devilix.net>2014-10-05 23:00:08 +0200
commitd444d445ed0458a352ecb9ff79ffd158677ee805 (patch)
treedcdbe4b38dbb343498b2ea2a37556cb358cd5720 /system
parent86d7eadf102c798f2aa70a86e86fd0f5050d9574 (diff)
config_item() to return NULL instead of FALSE for non-existing items
Close #3001 Close #3232 Related: #3244
Diffstat (limited to 'system')
-rw-r--r--system/core/Common.php2
-rw-r--r--system/core/Exceptions.php16
-rw-r--r--system/core/Input.php2
-rwxr-xr-xsystem/core/Security.php6
-rw-r--r--system/libraries/Encrypt.php2
5 files changed, 16 insertions, 12 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index b5a696c68..504e22571 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -289,7 +289,7 @@ if ( ! function_exists('config_item'))
$_config[0] =& get_config();
}
- return isset($_config[0][$item]) ? $_config[0][$item] : FALSE;
+ return isset($_config[0][$item]) ? $_config[0][$item] : NULL;
}
}
diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php
index cb4bc3cd6..49c2217c9 100644
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -145,9 +145,11 @@ class CI_Exceptions {
*/
public function show_error($heading, $message, $template = 'error_general', $status_code = 500)
{
- $templates_path = config_item('error_views_path')
- ? config_item('error_views_path')
- : VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
+ $templates_path = config_item('error_views_path');
+ if (empty($templates_path))
+ {
+ $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
+ }
if (is_cli())
{
@@ -185,9 +187,11 @@ class CI_Exceptions {
*/
public function show_php_error($severity, $message, $filepath, $line)
{
- $templates_path = config_item('error_views_path')
- ? config_item('error_views_path')
- : VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
+ $templates_path = config_item('error_views_path');
+ if (empty($templates_path))
+ {
+ $templates_path = VIEWPATH.'errors'.DIRECTORY_SEPARATOR;
+ }
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;
diff --git a/system/core/Input.php b/system/core/Input.php
index ada9fc680..9ae2f6d6f 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -353,7 +353,7 @@ class CI_Input {
$path = config_item('cookie_path');
}
- if ($secure === FALSE && config_item('cookie_secure') !== FALSE)
+ if ($secure === FALSE && config_item('cookie_secure') === TRUE)
{
$secure = config_item('cookie_secure');
}
diff --git a/system/core/Security.php b/system/core/Security.php
index 15a66430a..cffdb9ad9 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -158,7 +158,7 @@ class CI_Security {
public function __construct()
{
// Is CSRF protection enabled?
- if (config_item('csrf_protection') === TRUE)
+ if (config_item('csrf_protection'))
{
// CSRF config
foreach (array('csrf_expire', 'csrf_token_name', 'csrf_cookie_name') as $key)
@@ -170,9 +170,9 @@ class CI_Security {
}
// Append application specific cookie prefix
- if (config_item('cookie_prefix'))
+ if ($cookie_prefix = config_item('cookie_prefix'))
{
- $this->_csrf_cookie_name = config_item('cookie_prefix').$this->_csrf_cookie_name;
+ $this->_csrf_cookie_name = $cookie_prefix.$this->_csrf_cookie_name;
}
// Set the CSRF hash
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 995bf0bbe..1af42ed1f 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -111,7 +111,7 @@ class CI_Encrypt {
$key = config_item('encryption_key');
- if ($key === FALSE)
+ if ( ! strlen($key))
{
show_error('In order to use the encryption class requires that you set an encryption key in your config file.');
}