What are the steps required to reproduce the bug?
See /core/modules/views/src/Element/View.php
It can be reproduced by opening a page with a View (in a block), deleting the View, or (easier) by adding some extra characters to view name ($element['#name']
) in $view = Views::getView($element['#name']);
line, to force an error (eg $element['#name'].'XXX'
).
What behaviour were you expecting?
Normal View output
What happened instead?
You get an error: Fatal error: Unsupported operand types in ...../core/modules/views/src/Element/View.php on line 49
This is could be more helpful.
Solution
Test for null return in $view and add a message like 'drupal_set_message(t('View '.$element['#name'].', used on this page, is missing.'), 'error');
', and return.
(see patch)