Skip to content
Permalink
Browse files

Account for input named '0'.

  • Loading branch information...
ADmad committed Mar 29, 2015
1 parent 12b4cea commit e3275099a0f9b694c2aa442c3a9f514d335541f1
Showing with 6 additions and 2 deletions.
  1. +2 −2 src/View/Helper/FormHelper.php
  2. +4 −0 tests/TestCase/View/Helper/FormHelperTest.php
@@ -617,7 +617,7 @@ public function unlockField($name = null)
*/
protected function _secure($lock, $field, $value = null)
{
if (empty($field)) {
if (empty($field) && $field !== '0') {
return;
}
@@ -2390,7 +2390,7 @@ protected function _initInputField($field, $options = [])
*/
protected function _secureFieldName($name)
{
if (empty($name)) {
if (empty($name) && $name !== '0') {
return [];
}
@@ -275,6 +275,10 @@ public function testRenderingWidgetWithEmptyName()
$result = $this->Form->widget('select', ['secure' => true, 'name' => '']);
$this->assertEquals('<select name=""></select>', $result);
$this->assertEquals([], $this->Form->fields);
$result = $this->Form->widget('select', ['secure' => true, 'name' => '0']);
$this->assertEquals('<select name="0"></select>', $result);
$this->assertEquals(['0'], $this->Form->fields);
}
/**

0 comments on commit e327509

Please sign in to comment.
You can’t perform that action at this time.