Browse Source

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
mark_story 13 years ago
parent
commit
c77c7a7347
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/Cake/View/Helper/FormHelper.php

+ 1 - 1
lib/Cake/View/Helper/FormHelper.php

@@ -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)) {