BC fixes for habtm. Closes #3545.

Signed-off-by: Rachman Chavik <rchavik@xintesa.com>
This commit is contained in:
euromark 2013-01-30 13:54:09 +01:00 committed by Rachman Chavik
parent 0a96e200a6
commit d504642c9b
2 changed files with 3 additions and 2 deletions

View file

@ -4056,7 +4056,7 @@ class FormHelperTest extends CakeTestCase {
'Contact' => array(),
'ContactTag' => array(
array(
'id' => 1,
'id' => '1',
'name' => 'blue'
),
array(

View file

@ -2475,9 +2475,10 @@ class FormHelper extends AppHelper {
}
if ($name !== null) {
$isNumeric = is_numeric($name);
if (
(!$selectedIsArray && !$selectedIsEmpty && (string)$attributes['value'] == (string)$name) ||
($selectedIsArray && in_array($name, $attributes['value'], true))
($selectedIsArray && in_array($name, $attributes['value'], !$isNumeric))
) {
if ($attributes['style'] === 'checkbox') {
$htmlOptions['checked'] = true;