|
|
@@ -157,24 +157,21 @@ class Zend_Config_Ini extends Zend_Config
|
|
|
|
|
|
$this->_loadedSection = $section;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
- * Load the ini file and preprocess the section separator (':' in the
|
|
|
- * section name (that is used for section extension) so that the resultant
|
|
|
- * array has the correct section names and the extension information is
|
|
|
- * stored in a sub-key called ';extends'. We use ';extends' as this can
|
|
|
- * never be a valid key name in an INI file that has been loaded using
|
|
|
- * parse_ini_file().
|
|
|
- *
|
|
|
+ * Load the INI file from disk using parse_ini_file(). Use a private error
|
|
|
+ * handler to convert any loading errors into a Zend_Config_Exception
|
|
|
+ *
|
|
|
* @param string $filename
|
|
|
* @throws Zend_Config_Exception
|
|
|
* @return array
|
|
|
*/
|
|
|
- protected function _loadIniFile($filename)
|
|
|
+ protected function _parseIniFile($filename)
|
|
|
{
|
|
|
set_error_handler(array($this, '_loadFileErrorHandler'));
|
|
|
- $loaded = parse_ini_file($filename, true); // Warnings and errors are suppressed
|
|
|
+ $iniArray = parse_ini_file($filename, true); // Warnings and errors are suppressed
|
|
|
restore_error_handler();
|
|
|
+
|
|
|
// Check if there was a error while loading file
|
|
|
if ($this->_loadFileErrorStr !== null) {
|
|
|
/**
|
|
|
@@ -183,7 +180,25 @@ class Zend_Config_Ini extends Zend_Config
|
|
|
require_once 'Zend/Config/Exception.php';
|
|
|
throw new Zend_Config_Exception($this->_loadFileErrorStr);
|
|
|
}
|
|
|
+
|
|
|
+ return $iniArray;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * Load the ini file and preprocess the section separator (':' in the
|
|
|
+ * section name (that is used for section extension) so that the resultant
|
|
|
+ * array has the correct section names and the extension information is
|
|
|
+ * stored in a sub-key called ';extends'. We use ';extends' as this can
|
|
|
+ * never be a valid key name in an INI file that has been loaded using
|
|
|
+ * parse_ini_file().
|
|
|
+ *
|
|
|
+ * @param string $filename
|
|
|
+ * @throws Zend_Config_Exception
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ protected function _loadIniFile($filename)
|
|
|
+ {
|
|
|
+ $loaded = $this->_parseIniFile($filename);
|
|
|
$iniArray = array();
|
|
|
foreach ($loaded as $key => $data)
|
|
|
{
|