From 95c31adc770164f27c8dd678f30c60494827af02 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 17 Dec 2014 19:01:31 +0200 Subject: Extend fix for #3419 --- system/core/Loader.php | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'system') diff --git a/system/core/Loader.php b/system/core/Loader.php index e0a7d5e1b..afdedf522 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1090,31 +1090,38 @@ class CI_Loader { if (is_array($config_component->_config_paths)) { - // Break on the first found file, thus package files - // are not overridden by default paths + $found = FALSE; foreach ($config_component->_config_paths as $path) { // We test for both uppercase and lowercase, for servers that - // are case-sensitive with regard to file names. Check for environment - // first, global next + // are case-sensitive with regard to file names. Load global first, + // override with environment next + if (file_exists($path.'config/'.strtolower($class).'.php')) + { + include($path.'config/'.strtolower($class).'.php'); + $found = TRUE; + } + elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) + { + include($path.'config/'.ucfirst(strtolower($class)).'.php'); + $found = TRUE; + } + if (file_exists($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php')) { include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); - break; + $found = TRUE; } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) { include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); - break; + $found = TRUE; } - elseif (file_exists($path.'config/'.strtolower($class).'.php')) - { - include($path.'config/'.strtolower($class).'.php'); - break; - } - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) + + // Break on the first found configuration, thus package + // files are not overridden by default paths + if ($found === TRUE) { - include($path.'config/'.ucfirst(strtolower($class)).'.php'); break; } } @@ -1193,14 +1200,11 @@ class CI_Loader { */ protected function _ci_autoloader() { + include(APPPATH.'config/autoload.php'); if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); } - else - { - include(APPPATH.'config/autoload.php'); - } if ( ! isset($autoload)) { -- cgit v1.2.3-24-g4f1b