Index: tests/Zend/View/Helper/FormTest.php =================================================================== --- tests/Zend/View/Helper/FormTest.php (revision 23530) +++ tests/Zend/View/Helper/FormTest.php (working copy) @@ -108,6 +108,24 @@ $form = $this->helper->form('', array('action' => '/foo', 'method' => 'get', 'id' => null)); $this->assertNotRegexp('/]*(id="")/', $form); } + + /** + * @see ZF-10791 + */ + public function testPassingNameAsAttributeShouldRenderNameAttrib() + { + $form = $this->helper->form('', array('action' => '/foo', 'method' => 'get', 'name' => 'SomeNameAttr')); + $this->assertRegexp('/]*(name="SomeNameAttr")/', $form); + } + + /** + * @see ZF-10791 + */ + public function testEmptyNameAttributeShouldNotRenderNameAttrib() + { + $form = $this->helper->form('', array('action' => '/foo', 'method' => 'get')); + $this->assertNotRegexp('/]*(name=".*")/', $form); + } } // Call Zend_View_Helper_FormTest::main() if this source file is executed directly. Index: library/Zend/View/Helper/FormElement.php =================================================================== --- library/Zend/View/Helper/FormElement.php (revision 23530) +++ library/Zend/View/Helper/FormElement.php (working copy) @@ -160,7 +160,8 @@ // Remove attribs that might overwrite the other keys. We do this LAST // because we needed the other attribs values earlier. foreach ($info as $key => $val) { - if (array_key_exists($key, $attribs)) { + //AAL 20101217 -- Allow override of name attribute + if ($key !== 'name' && array_key_exists($key, $attribs)) { unset($attribs[$key]); } }