Index: library/Zend/View/Helper/HeadMeta.php =================================================================== --- library/Zend/View/Helper/HeadMeta.php (revision 13992) +++ library/Zend/View/Helper/HeadMeta.php (working copy) @@ -329,6 +329,7 @@ : $this->getIndent(); $items = array(); + $this->getContainer()->ksort(); foreach ($this as $item) { $items[] = $this->itemToString($item); } Index: library/Zend/View/Helper/HeadStyle.php =================================================================== --- library/Zend/View/Helper/HeadStyle.php (revision 13992) +++ library/Zend/View/Helper/HeadStyle.php (working copy) @@ -362,6 +362,7 @@ : $this->getIndent(); $items = array(); + $this->getContainer()->ksort(); foreach ($this as $item) { if (!$this->_isValid($item)) { continue; Index: library/Zend/View/Helper/HeadScript.php =================================================================== --- library/Zend/View/Helper/HeadScript.php (revision 13992) +++ library/Zend/View/Helper/HeadScript.php (working copy) @@ -446,6 +446,7 @@ $escapeEnd = ($useCdata) ? '//]]>' : '//-->'; $items = array(); + $this->getContainer()->ksort(); foreach ($this as $item) { if (!$this->_isValid($item)) { continue; Index: library/Zend/View/Helper/HeadLink.php =================================================================== --- library/Zend/View/Helper/HeadLink.php (revision 13992) +++ library/Zend/View/Helper/HeadLink.php (working copy) @@ -307,6 +307,7 @@ : $this->getIndent(); $items = array(); + $this->getContainer()->ksort(); foreach ($this as $item) { $items[] = $this->itemToString($item); } Index: tests/Zend/View/Helper/HeadMetaTest.php =================================================================== --- tests/Zend/View/Helper/HeadMetaTest.php (revision 13992) +++ tests/Zend/View/Helper/HeadMetaTest.php (working copy) @@ -372,6 +372,24 @@ ); } + public function testZF5435() + { + + $this->helper->offsetSetName(1, 'keywords', 'foo'); + $this->helper->offsetSetName(10, 'description', 'foo'); + $this->helper->offsetSetHttpEquiv(20, 'pragma', 'baz'); + $this->helper->offsetSetHttpEquiv(5, 'Cache-control', 'baz'); + + $test = $this->helper->toString(); + + $expected = ' + + +'; + + $this->assertEquals($expected, $test); + } + } // Call Zend_View_Helper_HeadMetaTest::main() if this source file is executed directly. Index: tests/Zend/View/Helper/HeadStyleTest.php =================================================================== --- tests/Zend/View/Helper/HeadStyleTest.php (revision 13992) +++ tests/Zend/View/Helper/HeadStyleTest.php (working copy) @@ -385,7 +385,42 @@ $test = $this->helper->toString(); $this->assertContains(' + +'; + + $this->assertEquals($expected, $test); + } +} // Call Zend_View_Helper_HeadStyleTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == "Zend_View_Helper_HeadStyleTest::main") { Index: tests/Zend/View/Helper/HeadScriptTest.php =================================================================== --- tests/Zend/View/Helper/HeadScriptTest.php (revision 13992) +++ tests/Zend/View/Helper/HeadScriptTest.php (working copy) @@ -398,6 +398,25 @@ $test = $this->helper->headScript()->toString(); $this->assertContains('