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(), 'Contact' => array(),
'ContactTag' => array( 'ContactTag' => array(
array( array(
'id' => 1, 'id' => '1',
'name' => 'blue' 'name' => 'blue'
), ),
array( array(

View file

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