Browse Source

Fix overzealous array cast in multiCheckbox.

Refs #3317
mark_story 12 years ago
parent
commit
292d7e81cd
2 changed files with 7 additions and 2 deletions
  1. 2 2
      src/View/Helper/FormHelper.php
  2. 5 0
      tests/TestCase/View/Helper/FormHelperTest.php

+ 2 - 2
src/View/Helper/FormHelper.php

@@ -1621,13 +1621,13 @@ class FormHelper extends Helper {
  * Can be used in place of a select box with the multiple attribute.
  *
  * @param string $fieldName Name attribute of the SELECT
- * @param array $options Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the
+ * @param array $options|\Traversable Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the
  *   checkboxes element.
  * @param array $attributes The HTML attributes of the select element.
  * @return string Formatted SELECT element
  * @see \Cake\View\Helper\FormHelper::select() for supported option formats.
  */
-	public function multiCheckbox($fieldName, array $options, array $attributes = []) {
+	public function multiCheckbox($fieldName, $options, array $attributes = []) {
 		$attributes += [
 			'disabled' => null,
 			'escape' => true,

+ 5 - 0
tests/TestCase/View/Helper/FormHelperTest.php

@@ -3864,6 +3864,11 @@ class FormHelperTest extends TestCase {
 		);
 		$this->assertTags($result, $expected);
 
+		$result = $this->Form->multiCheckbox(
+			'category',
+			new Collection(['1', '2']),
+			['name' => 'fish']
+		);
 		$result = $this->Form->multiCheckbox('category', ['1', '2'], [
 			'name' => 'fish',
 		]);