diff options
author | Andrey Andreev <narf@devilix.net> | 2022-01-05 20:56:00 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2022-01-05 20:56:00 +0100 |
commit | 004f0a1b41c27e3d40f62a51300599d35c54c0c0 (patch) | |
tree | 567d0f7c1466ed899e89cc0d660e076e3e5755bf /system/core/Loader.php | |
parent | 2afffc07780f29767d8b212f7c2cbde4ab56ef51 (diff) |
Polish changes from PR #5373
Diffstat (limited to 'system/core/Loader.php')
-rw-r--r-- | system/core/Loader.php | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/system/core/Loader.php b/system/core/Loader.php index fb8b73b1f..de08615f3 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -94,7 +94,7 @@ class CI_Loader { protected $_ci_cached_vars = array(); /** - * Stack of variable arrays to provide nested _ci_load calls all variables from parent calls + * Stack of variable arrays to provide nested _ci_load calls with all variables from parent calls * * @var array */ @@ -956,17 +956,10 @@ class CI_Loader { * configuration. */ - // Init current _ci_vars as current variable configuration - if ( ! is_array($_ci_vars)) - { - $_ci_vars = []; - } + is_array($_ci_vars) && $_ci_vars = array(); // Include the global cached vars into the current _ci_vars if needed - if ( ! empty($this->_ci_cached_vars)) - { - $_ci_vars = array_merge($this->_ci_cached_vars, $_ci_vars); - } + empty($this->_ci_cached_vars) OR $_ci_vars = array_merge($this->_ci_cached_vars, $_ci_vars); // Merge the last variable configuration from a parent _ci_load() // call into the current _ci_vars @@ -976,10 +969,7 @@ class CI_Loader { $_ci_vars = array_merge($previous_variable_configuration, $_ci_vars); } - // Push the current _ci_vars to the stack array_push($this->_ci_load_vars_stack, $_ci_vars); - - // Extract the current _ci_vars extract($_ci_vars); /** @@ -998,7 +988,7 @@ class CI_Loader { include($_ci_path); // include() vs include_once() allows for multiple views with the same name log_message('info', 'File loaded: '.$_ci_path); - // Remove current _ci_vars from stack again + // Remove current _ci_vars from stack array_pop($this->_ci_load_vars_stack); // Return the file data if requested |