Strict in_array for mixed id variable types

Setting the in_array check to strict, as this would return true
incorrectly when and if values are of mixed type.
This commit is contained in:
johnymonster 2013-01-17 14:14:12 -05:00
parent 689745d705
commit 84b10ba707

View file

@ -2471,7 +2471,7 @@ class FormHelper extends AppHelper {
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;