Permalink
Browse files

Accept strings as disabled value.

Old FormHelper was pretty permissive about disabled values. So
we can keep that going forward.
  • Loading branch information...
1 parent 148fd51 commit e52f8241387afb81eda9b57306ca77cc3f8930f7 @markstory markstory committed Feb 28, 2014
Showing with 5 additions and 1 deletion.
  1. +1 −1 src/View/Widget/MultiCheckbox.php
  2. +4 −0 tests/TestCase/View/Widget/MultiCheckboxTest.php
@@ -197,7 +197,7 @@ protected function _isDisabled($key, $disabled) {
if ($disabled === null || $disabled === false) {
return false;
}
- if ($disabled === true) {
+ if ($disabled === true || is_string($disabled)) {
return true;
}
$strict = !is_numeric($key);
@@ -257,6 +257,10 @@ public function testRenderDisabled() {
];
$this->assertTags($result, $expected);
+ $data['disabled'] = 'a string';
+ $result = $input->render($data);
+ $this->assertTags($result, $expected);
+
$data['disabled'] = ['1', '1x'];
$this->assertTags($result, $expected);

0 comments on commit e52f824

Please sign in to comment.