- last update
over 1 year ago 29 pass, 1 fail
Current implementation of Drupal\panels\Plugin\DisplayBuilder\StandardDisplayBuilder::buildRegions()
has a wrong condition which could lead to TypeError
(null
instead of expected array
) in \Drupal\Core\Render\Element::isEmpty()
.
Example:
$content = $block->build();
if ($content !== NULL && !Element::isEmpty($content)) {
foreach (['#attributes', '#contextual_links'] as $property) {
if (isset($content[$property])) {
$block_render_array[$property] += $content[$property];
unset($content[$property]);
}
}
}
// If the block is empty, instead of trying to render the block
// correctly return just #cache, so that the render system knows the
// reasons (cache contexts & tags) why this block is empty.
if (Element::isEmpty($content)) {
The Element::isEmpty($content)
on second execution fails with fatal error when $content
contains null
.
Steps to reproduce described in #2819219: Fatal error when "setMainContent()" method is not called (block module not installed) → .
@capuleto #8:
This patch also makes Drupal\Core\Render\Element::children() trigger several warnings like
"max-age" is an invalid render array key
@Devin Carlson #9:
This also doesn't check if $content !== NULL, as is done earlier in the function, which causes a fatal error if $content is NULL.
Recoverable fatal error: Argument 1 passed to Drupal\Core\Render\Element::isEmpty() must be of the type array, null given called in panels/src/Plugin/DisplayBuilder/StandardDisplayBuilder.php on line 136.
Needs work
4.0
Code
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.