Index: library/Zend/Form.php =================================================================== --- library/Zend/Form.php (revision 22930) +++ library/Zend/Form.php (revision ) @@ -354,7 +354,7 @@ } $forbidden = array( - 'Options', 'Config', 'PluginLoader', 'SubForms', 'View', 'Translator', + 'Options', 'Config', 'PluginLoader', 'SubForms', 'Translator', 'Attrib', 'Default', ); @@ -366,6 +366,9 @@ $method = 'set' . $normalized; if (method_exists($this, $method)) { + if($normalized == 'View' && !($value instanceof Zend_View_Interface)) { + continue; + } $this->$method($value); } else { $this->setAttrib($key, $value); Index: tests/Zend/Form/FormTest.php =================================================================== --- tests/Zend/Form/FormTest.php (revision 22930) +++ tests/Zend/Form/FormTest.php (revision ) @@ -4388,7 +4388,27 @@ $html = $form->render($this->getView()); $this->assertEquals(1, substr_count($html, 'Customer Type'), $html); } + + /** + * @group ZF-10149 + */ + public function testIfViewIsSetInTime() + { + try { + $form = new Zend_Form(array('view' => new MyTestView())); + $this->assertTrue($form->getView() instanceof MyTestView); + + $form = new Zend_Form(array('view' => new StdClass())); + $this->assertNull($form->getView()); + + $result = $form->render(); -} + } + catch (Zend_Form_Exception $e) { + $this->fail('Setting a view object using the options array should not throw an exception'); + } + $this->assertNotEquals($result,''); + } +} class Zend_Form_FormTest_DisplayGroup extends Zend_Form_DisplayGroup { @@ -4430,6 +4450,11 @@ } } +class MyTestView extends Zend_View +{ + +} + if (PHPUnit_MAIN_METHOD == 'Zend_Form_FormTest::main') { Zend_Form_FormTest::main(); }