summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-03-11 17:19:23 +0100
committerAndrey Andreev <narf@devilix.net>2016-03-11 17:19:23 +0100
commit92d1cc05362998ceabe39c4023f41fd939c1f5b2 (patch)
treea506f92f27313435ee53ea2153c958356c785fba
parent1be8987176ad422ae6bc8af5c8f148eba9b5dff1 (diff)
Add a defensive check in CI_Loader::_ci_load()
Prevents possible internal variable overwrites when loading views
-rw-r--r--system/core/Loader.php8
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 9 insertions, 0 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php
index 62781a7bf..c742ae71a 100644
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -936,6 +936,14 @@ class CI_Loader {
*/
if (is_array($_ci_vars))
{
+ foreach (array_keys($_ci_vars) as $key)
+ {
+ if (strncmp($key, '_ci_', 4) === 0)
+ {
+ unset($_ci_vars[$key]);
+ }
+ }
+
$this->_ci_cached_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
}
extract($this->_ci_cached_vars);
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 52e8d13d6..11d7918e7 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -10,6 +10,7 @@ Release Date: Not Released
- Core
- Changed :doc:`Loader Library <libraries/loader>` to allow ``$autoload['drivers']`` assigning with custom property names.
+ - Changed :doc:`Loader Library <libraries/loader>` to ignore variables prefixed with '_ci_' when loading views.
- General Changes