mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Merge pull request #844 from dogmatic69/form-bug
Adding a check to the object before use
This commit is contained in:
commit
98992e021a
1 changed files with 1 additions and 1 deletions
|
@ -146,7 +146,7 @@ class FormHelper extends AppHelper {
|
||||||
));
|
));
|
||||||
} elseif (ClassRegistry::isKeySet($this->defaultModel)) {
|
} elseif (ClassRegistry::isKeySet($this->defaultModel)) {
|
||||||
$defaultObject = ClassRegistry::getObject($this->defaultModel);
|
$defaultObject = ClassRegistry::getObject($this->defaultModel);
|
||||||
if (in_array($model, array_keys($defaultObject->getAssociated()), true) && isset($defaultObject->{$model})) {
|
if ($defaultObject && in_array($model, array_keys($defaultObject->getAssociated()), true) && isset($defaultObject->{$model})) {
|
||||||
$object = $defaultObject->{$model};
|
$object = $defaultObject->{$model};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue