Skip to content

Commit 004f0a1

Browse files
committed
Polish changes from PR #5373
1 parent 2afffc0 commit 004f0a1

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

system/core/Loader.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class CI_Loader {
9494
protected $_ci_cached_vars = array();
9595

9696
/**
97-
* Stack of variable arrays to provide nested _ci_load calls all variables from parent calls
97+
* Stack of variable arrays to provide nested _ci_load calls with all variables from parent calls
9898
*
9999
* @var array
100100
*/
@@ -956,17 +956,10 @@ protected function _ci_load($_ci_data)
956956
* configuration.
957957
*/
958958

959-
// Init current _ci_vars as current variable configuration
960-
if ( ! is_array($_ci_vars))
961-
{
962-
$_ci_vars = [];
963-
}
959+
is_array($_ci_vars) && $_ci_vars = array();
964960

965961
// Include the global cached vars into the current _ci_vars if needed
966-
if ( ! empty($this->_ci_cached_vars))
967-
{
968-
$_ci_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
969-
}
962+
empty($this->_ci_cached_vars) OR $_ci_vars = array_merge($this->_ci_cached_vars, $_ci_vars);
970963

971964
// Merge the last variable configuration from a parent _ci_load()
972965
// call into the current _ci_vars
@@ -976,10 +969,7 @@ protected function _ci_load($_ci_data)
976969
$_ci_vars = array_merge($previous_variable_configuration, $_ci_vars);
977970
}
978971

979-
// Push the current _ci_vars to the stack
980972
array_push($this->_ci_load_vars_stack, $_ci_vars);
981-
982-
// Extract the current _ci_vars
983973
extract($_ci_vars);
984974

985975
/**
@@ -998,7 +988,7 @@ protected function _ci_load($_ci_data)
998988
include($_ci_path); // include() vs include_once() allows for multiple views with the same name
999989
log_message('info', 'File loaded: '.$_ci_path);
1000990

1001-
// Remove current _ci_vars from stack again
991+
// Remove current _ci_vars from stack
1002992
array_pop($this->_ci_load_vars_stack);
1003993

1004994
// Return the file data if requested

tests/mocks/database/ci_test.sqlite

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)