From d9a0aa1c69e239cc8ccdd2fe889e884019455723 Mon Sep 17 00:00:00 2001 From: dho Date: Fri, 15 Jun 2007 08:32:04 +0000 Subject: [PATCH] Applying patch from ticket #2763, adding test for it git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5278 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helpers/form.php | 2 +- cake/tests/cases/libs/view/helpers/form.test.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 65f11d02a..4668db64d 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -651,7 +651,7 @@ class FormHelper extends AppHelper { } $output = null; - if(isset($object) && ($options['value'] == 0 || $options['value'] == 1)) { + if(isset($object) && isset($options['value']) && ($options['value'] == 0 || $options['value'] == 1)) { $db =& ConnectionManager::getDataSource($object->useDbConfig); $value = $db->boolean($options['value']); $options['value'] = 1; diff --git a/cake/tests/cases/libs/view/helpers/form.test.php b/cake/tests/cases/libs/view/helpers/form.test.php index 93093d5dc..53ac2edda 100644 --- a/cake/tests/cases/libs/view/helpers/form.test.php +++ b/cake/tests/cases/libs/view/helpers/form.test.php @@ -830,6 +830,9 @@ class FormHelperTest extends CakeTestCase { $this->Form->validationErrors['Model']['field'] = 0; $result = $this->Form->checkbox('Model.field', array('value' => 'myvalue')); $this->assertEqual($result, ''); + + $result = $this->Form->checkbox('Contact.field', array('value' => 'myvalue')); + $this->assertEqual($result, ''); $this->Form->validationErrors['Model']['field'] = 1; $this->Form->data['Contact']['published'] = 1;