Index: library/Zend/Config/Yaml.php =================================================================== --- library/Zend/Config/Yaml.php (revision 24580) +++ library/Zend/Config/Yaml.php (working copy) @@ -126,7 +126,7 @@ * * @param string $yaml YAML file to process * @param mixed $section Section to process - * @param array|boolean $options + * @param array|boolean $options */ public function __construct($yaml, $section = null, $options = false) { @@ -285,7 +285,7 @@ $inIndent = false; while (list($n, $line) = each($lines)) { $lineno = $n + 1; - + $line = rtrim(preg_replace("/#.*$/", "", $line)); if (strlen($line) == 0) { continue; @@ -310,7 +310,7 @@ $inIndent = true; } - if (preg_match("/(\w+):\s*(.*)/", $line, $m)) { + if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $line, $m)) { // key: value if (strlen($m[2])) { // simple key: value Index: tests/Zend/Config/_files/array.yaml =================================================================== --- tests/Zend/Config/_files/array.yaml (revision 24580) +++ tests/Zend/Config/_files/array.yaml (working copy) @@ -20,3 +20,11 @@ - eight: 3 nine: 3 +te-n: + ele-ven: + - + twel-ve: 101112 + twelve: 101112 + + - thir-teen + Index: tests/Zend/Config/YamlTest.php =================================================================== --- tests/Zend/Config/YamlTest.php (revision 24580) +++ tests/Zend/Config/YamlTest.php (working copy) @@ -319,7 +319,7 @@ $this->assertEquals('ZEND_CONFIG_YAML_ENV', $config->env); $this->assertEquals('ZEND_CONFIG_YAML_ENV_PATH/test/this', $config->path); } - + /** * @group ZF-11329 */ @@ -329,7 +329,7 @@ $this->assertType('Zend_Config', $config->resources); $this->assertType('Zend_Config', $config->resources->frontController); $this->assertType( - 'string', + 'string', $config->resources->frontController->controllerDirectory ); $this->assertSame( @@ -337,7 +337,7 @@ $config->resources->frontController->controllerDirectory ); } - + /** * @group ZF-11384 */ @@ -347,7 +347,7 @@ $this->assertType('Zend_Config', $config->resources); $this->assertType('Zend_Config', $config->resources->frontController); $this->assertType( - 'string', + 'string', $config->resources->frontController->controllerDirectory ); $this->assertSame( @@ -355,7 +355,7 @@ $config->resources->frontController->controllerDirectory ); } - + /** * @group ZF-11702 */ @@ -363,13 +363,13 @@ { if (!defined('ZEND_CONFIG_YAML_TEST_PATH')) { define('ZEND_CONFIG_YAML_TEST_PATH', 'testing'); - } + } $config = new Zend_Config_Yaml($this->_yamlListConstantsConfig, 'production'); $this->assertEquals(ZEND_CONFIG_YAML_TEST_PATH, $config->paths->{0}); $this->assertEquals(ZEND_CONFIG_YAML_TEST_PATH . '/library/test', $config->paths->{1}); } - + /** * @group ZF-11702 */ @@ -405,5 +405,17 @@ $this->assertFalse($config->usingTitleCasedOff->{0}); $this->assertFalse($config->usingCapitalOff->{0}); } - + + /** + * @group ZF-11363 + */ + public function testAllowsDashesInLists() + { + $config = new Zend_Config_Yaml($this->_iniFileSameNameKeysConfig, null); + $this->assertEquals('101112', $config->{'te-n'}->{'ele-ven'}->{0}->{'twel-ve'}); + + $this->assertEquals('101112', $config->{'te-n'}->{'ele-ven'}->{0}->twelve); + + $this->assertEquals('thir-teen', $config->{'te-n'}->{'ele-ven'}->{1}); + } }