Skip to content

Commit

Permalink
Strict in_array for mixed id variable types
Browse files Browse the repository at this point in the history
Setting the in_array check to strict, as this would return true
incorrectly when and if values are of mixed type.
  • Loading branch information
jhnlsn committed Jan 17, 2013
1 parent 689745d commit 84b10ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -2471,7 +2471,7 @@ protected function _selectOptions($elements = array(), $parents = array(), $show
if ($name !== null) {
if (
(!$selectedIsArray && !$selectedIsEmpty && (string)$attributes['value'] == (string)$name) ||
($selectedIsArray && in_array($name, $attributes['value']))
($selectedIsArray && in_array($name, $attributes['value'], true))
) {
if ($attributes['style'] === 'checkbox') {
$htmlOptions['checked'] = true;
Expand Down

0 comments on commit 84b10ba

Please sign in to comment.