diff options
author | Andrey Andreev <narf@devilix.net> | 2014-12-16 15:16:45 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-12-16 15:16:45 +0100 |
commit | 42bc6d51e15c180f35632d5c03c649225f8dbf74 (patch) | |
tree | 0cb000e668153eb2abf1e23a3998487ac6fd6bc6 /system/core/Config.php | |
parent | 91b38db77d6863a6eed36fcc15feea5ba9a6343f (diff) |
Fix #3419
Diffstat (limited to 'system/core/Config.php')
-rw-r--r-- | system/core/Config.php | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/system/core/Config.php b/system/core/Config.php index d8a606c14..ca865cebf 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -120,74 +120,61 @@ class CI_Config { foreach ($this->_config_paths as $path) { - $found = FALSE; - foreach (array(ENVIRONMENT.'/'.$file, $file) as $location) + foreach (array($file, ENVIRONMENT.'/'.$file) as $location) { $file_path = $path.'config/'.$location.'.php'; if (in_array($file_path, $this->is_loaded, TRUE)) { - $loaded = TRUE; - continue 2; + return TRUE; } - if (file_exists($file_path)) + if ( ! file_exists($file_path)) { - $found = TRUE; - break; + continue; } - } - - if ($found === FALSE) - { - continue; - } - include($file_path); + include($file_path); - if ( ! isset($config) OR ! is_array($config)) - { - if ($fail_gracefully === TRUE) + if ( ! isset($config) OR ! is_array($config)) { - return FALSE; + if ($fail_gracefully === TRUE) + { + return FALSE; + } + + show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.'); } - show_error('Your '.$file_path.' file does not appear to contain a valid configuration array.'); - } - if ($use_sections === TRUE) - { - if (isset($this->config[$file])) + if ($use_sections === TRUE) { - $this->config[$file] = array_merge($this->config[$file], $config); + $this->config[$file] = isset($this->config[$file]) + ? array_merge($this->config[$file], $config) + : $config; } else { - $this->config[$file] = $config; + $this->config = array_merge($this->config, $config); } + + $this->is_loaded[] = $file_path; + $config = NULL; + $loaded = TRUE; + log_message('debug', 'Config file loaded: '.$file_path); } - else + + if ($loaded === TRUE) { - $this->config = array_merge($this->config, $config); + return TRUE; } - - $this->is_loaded[] = $file_path; - unset($config); - - $loaded = TRUE; - log_message('debug', 'Config file loaded: '.$file_path); - break; } - if ($loaded === FALSE) + if ($fail_gracefully === TRUE) { - if ($fail_gracefully === TRUE) - { - return FALSE; - } - show_error('The configuration file '.$file.'.php does not exist.'); + return FALSE; } - return TRUE; + show_error('The configuration file '.$file.'.php does not exist.'); } // -------------------------------------------------------------------- |