Index: library/Zend/View/Helper/HeadScript.php =================================================================== --- library/Zend/View/Helper/HeadScript.php (revision 24628) +++ library/Zend/View/Helper/HeadScript.php (working copy) @@ -245,7 +245,7 @@ break; case 'file': default: - if (!$this->_isDuplicate($content)) { + if (!$this->_isDuplicate($content) || $action=='set') { $attrs['src'] = $content; $item = $this->createData($type, $attrs); if ('offsetSet' == $action) { Index: tests/Zend/View/Helper/HeadScriptTest.php =================================================================== --- tests/Zend/View/Helper/HeadScriptTest.php (revision 24628) +++ tests/Zend/View/Helper/HeadScriptTest.php (working copy) @@ -451,6 +451,20 @@ $this->assertEquals($expected, $test); } + + /** + * @group ZF-12048 + */ + public function testSetFileStillOverwritesExistingFilesWhenItsADuplicate() + { + $this->helper->appendFile('foo.js'); + $this->helper->appendFile('bar.js'); + $this->helper->setFile('foo.js'); + + $expected = ''; + $test = $this->helper->toString(); + $this->assertEquals($expected, $test); + } } // Call Zend_View_Helper_HeadScriptTest::main() if this source file is executed directly.