瀏覽代碼

ZF-8159: Zend_Config_Ini doesn't load multiple sections correctly

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19056 44c647ce-9c0f-0410-b52a-842ac1e357ba
jan 16 年之前
父節點
當前提交
e81c023840
共有 3 個文件被更改,包括 25 次插入1 次删除
  1. 1 1
      library/Zend/Config/Ini.php
  2. 20 0
      tests/Zend/Config/IniTest.php
  3. 4 0
      tests/Zend/Config/_files/zf8159.ini

+ 1 - 1
library/Zend/Config/Ini.php

@@ -149,7 +149,7 @@ class Zend_Config_Ini extends Zend_Config
                     require_once 'Zend/Config/Exception.php';
                     throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $filename");
                 }
-                $dataArray = array_merge($this->_processSection($iniArray, $sectionName), $dataArray);
+                $dataArray = array_merge_recursive($this->_processSection($iniArray, $sectionName), $dataArray);
 
             }
             parent::__construct($dataArray, $allowModifications);

+ 20 - 0
tests/Zend/Config/IniTest.php

@@ -268,6 +268,26 @@ class Zend_Config_IniTest extends PHPUnit_Framework_TestCase
         }
 
     }
+    
+    /**
+     * @group ZF-8159
+     */
+    public function testZF8159()
+    {
+        $config = new Zend_Config_Ini(
+            dirname(__FILE__) . '/_files/zf8159.ini',
+            array('first', 'second')
+        );
+        
+        $this->assertTrue(isset(
+           $config->user->login->elements->password
+        ));
+        
+        $this->assertEquals(
+            'password',
+            $config->user->login->elements->password->type
+        );
+    }
 
     /*
      * @group ZF-5800

+ 4 - 0
tests/Zend/Config/_files/zf8159.ini

@@ -0,0 +1,4 @@
+[first]
+user.login.elements.username.type = "text"
+[second]
+user.login.elements.password.type = "password"