Index: library/Zend/View/Helper/FormSelect.php =================================================================== --- library/Zend/View/Helper/FormSelect.php (revision 24537) +++ library/Zend/View/Helper/FormSelect.php (working copy) @@ -70,6 +70,9 @@ // force $value to array so we can compare multiple values to multiple // options; also ensure it's a string for comparison purposes. $value = array_map('strval', (array) $value); + if (is_array($disable)) { + $disable = array_map('strval', (array) $disable); + } // check if element may have multiple values $multiple = ''; @@ -117,7 +120,7 @@ foreach ((array) $options as $opt_value => $opt_label) { if (is_array($opt_label)) { $opt_disable = ''; - if (is_array($disable) && in_array($opt_value, $disable)) { + if (is_array($disable) && in_array($opt_value, $disable, true)) { $opt_disable = ' disabled="disabled"'; } if (null !== $translator) { @@ -158,6 +161,8 @@ if (is_bool($disable)) { $disable = array(); } + + $value = strval($value); $opt = 'assertRegexp('/]*?id="baz-optgroup-bar"[^>]*?"bar"[^>]*?/', $html, $html); } + /** + * @group ZF-11812 + */ + public function testDisableActuallyDisablesTheRightOptionWhenPresentedWithZeroValue() + { + $this->view->doctype('XHTML1_STRICT'); + $html = $this->helper->formSelect(array( + 'name' => 'baz', + 'options' => array( + '0' => 'Zeroth Item', + '-' => 'Look, it\'s a dash!' + ), + 'disable' => array('-') + )); + $this->assertNotRegexp('/]*?disabled/', $html, $html); + $this->assertNotRegexp('/