diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index cee9a772b..41cf2c1e9 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -5624,6 +5624,9 @@ class FormHelperTest extends CakeTestCase { '/select', ); $this->assertTags($result, $expected); + + $result = $this->Form->year('published', array(), array(), array('empty' => false)); + $this->assertContains('data[Contact][published][year]', $result); } /** diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 5498f2db8..fa8d0abbb 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -2461,17 +2461,9 @@ class FormHelper extends AppHelper { case 'year': $current = intval(date('Y')); - if (!isset($options['min'])) { - $min = $current - 20; - } else { - $min = $options['min']; - } + $min = !isset($options['min']) ? $current - 20 : (int)$options['min']; + $max = !isset($options['max']) ? $current + 20 : (int)$options['max']; - if (!isset($options['max'])) { - $max = $current + 20; - } else { - $max = $options['max']; - } if ($min > $max) { list($min, $max) = array($max, $min); }