Add check to make sure event result is an array in Form widget (#4331)

Wildcard listeners will add null responses to the event result array and causes an error when they are merged into the result. This PR adds a check to see if each event result is an array before adding it to the result array.

Credit to @SeriousKen. Fixes https://github.com/OFFLINE-GmbH/oc-clockwork-plugin/issues/1
This commit is contained in:
SeriousKen 2019-05-20 06:32:29 +01:00 committed by Ben Thomson
parent 019b0a3a6c
commit a9e198c8b4
1 changed files with 4 additions and 0 deletions

View File

@ -449,6 +449,10 @@ class Form extends WidgetBase
$eventResults = $this->fireSystemEvent('backend.form.refresh', [$result], false); $eventResults = $this->fireSystemEvent('backend.form.refresh', [$result], false);
foreach ($eventResults as $eventResult) { foreach ($eventResults as $eventResult) {
if (!is_array($eventResult)) {
continue;
}
$result = $eventResult + $result; $result = $eventResult + $result;
} }