summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2013-07-19 12:11:50 +0200
committerAndrey Andreev <narf@devilix.net>2013-07-19 12:11:50 +0200
commit29d884e308e26b2880b4f4285fbe9cf3a6f1e6e4 (patch)
treed57141f9042f97609a8ec3d47ef5fb5efab2c60e
parent12526cd2b8f69b5b283af0fb3c93ae81a8f4aada (diff)
parentcead4ccbcc6f9d6d8e2a65f69acd5196d05e75af (diff)
Merge pull request #2538 from vlakoff/develop-4
Fix config_item() returning stale values
-rw-r--r--system/core/Common.php15
-rw-r--r--user_guide_src/source/general/common_functions.rst4
2 files changed, 5 insertions, 14 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index 93cd0a0ae..b95a05db9 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -289,20 +289,15 @@ if ( ! function_exists('config_item'))
*/
function config_item($item)
{
- static $_config_item = array();
+ static $_config;
- if ( ! isset($_config_item[$item]))
+ if (empty($_config))
{
- $config =& get_config();
-
- if ( ! isset($config[$item]))
- {
- return FALSE;
- }
- $_config_item[$item] = $config[$item];
+ // references cannot be directly assigned to static variables, so we use an array
+ $_config[0] =& get_config();
}
- return $_config_item[$item];
+ return isset($_config[0][$item]) ? $_config[0][$item] : FALSE;
}
}
diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst
index a133fdc6d..32e8a8be0 100644
--- a/user_guide_src/source/general/common_functions.rst
+++ b/user_guide_src/source/general/common_functions.rst
@@ -68,10 +68,6 @@ accessing configuration information, however ``config_item()`` can be used
to retrieve single keys. See :doc:`Config Library <../libraries/config>`
documentation for more information.
-.. important:: This function only returns values set in your configuration
- files. It does not take into account config values that are
- dynamically set at runtime.
-
show_error()
============