config_item() to return NULL instead of FALSE for non-existing items
Close #3001
Close #3232
Related: #3244
diff --git a/system/core/Common.php b/system/core/Common.php
index b5a696c..504e225 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -289,7 +289,7 @@
$_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 cb4bc3c..49c2217 100644
--- a/system/core/Exceptions.php
+++ b/system/core/Exceptions.php
@@ -145,9 +145,11 @@
*/
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 @@
*/
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 ada9fc6..9ae2f6d 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -353,7 +353,7 @@
$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 15a6643..cffdb9a 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -158,7 +158,7 @@
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 @@
}
// 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