Fix warning with FormHelper::inputs()

introspectModel() can return non-array data sometimes. Casting avoids
warnings when forms are generate for models with no or faulty schema()
methods.

Refs #3602
This commit is contained in:
mark_story 2013-04-09 21:46:51 -04:00
parent 0e646a2a4d
commit c77c7a7347

View file

@ -845,7 +845,7 @@ class FormHelper extends AppHelper {
$modelFields = array();
$model = $this->model();
if ($model) {
$modelFields = array_keys($this->_introspectModel($model, 'fields'));
$modelFields = array_keys((array)$this->_introspectModel($model, 'fields'));
}
if (is_array($fields)) {
if (array_key_exists('legend', $fields) && !in_array('legend', $modelFields)) {