From 004f0a1b41c27e3d40f62a51300599d35c54c0c0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 5 Jan 2022 21:56:00 +0200 Subject: Polish changes from PR #5373 --- system/core/Loader.php | 18 ++++-------------- tests/mocks/database/ci_test.sqlite | Bin 19456 -> 19456 bytes 2 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 diff --git a/tests/mocks/database/ci_test.sqlite b/tests/mocks/database/ci_test.sqlite index d2a28439f..dae2ec2a0 100755 Binary files a/tests/mocks/database/ci_test.sqlite and b/tests/mocks/database/ci_test.sqlite differ -- cgit v1.2.3-24-g4f1b