mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
0e646a2a4d
commit
c77c7a7347
1 changed files with 1 additions and 1 deletions
|
@ -845,7 +845,7 @@ class FormHelper extends AppHelper {
|
||||||
$modelFields = array();
|
$modelFields = array();
|
||||||
$model = $this->model();
|
$model = $this->model();
|
||||||
if ($model) {
|
if ($model) {
|
||||||
$modelFields = array_keys($this->_introspectModel($model, 'fields'));
|
$modelFields = array_keys((array)$this->_introspectModel($model, 'fields'));
|
||||||
}
|
}
|
||||||
if (is_array($fields)) {
|
if (is_array($fields)) {
|
||||||
if (array_key_exists('legend', $fields) && !in_array('legend', $modelFields)) {
|
if (array_key_exists('legend', $fields) && !in_array('legend', $modelFields)) {
|
||||||
|
|
Loading…
Reference in a new issue