Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296466

Improve debugability of block plugins returning NULL in Layout Builder

$
0
0

Problem/Motivation

Placing a block that returns NULL will trigger
TypeError: Argument 1 passed to Drupal\Core\Cache\CacheableMetadata::createFromRenderArray() must be of the type array, null given, called in /app/web/core/modules/layout_builder/src/EventSubscriber/BlockComponentRenderArray.php on line 110 in Drupal\Core\Cache\CacheableMetadata::createFromRenderArray() (line 149 of /app/web/core/lib/Drupal/Core/Cache/CacheableMetadata.php)

BlockPluginInterface::build() is documented as always returning an array, but was written before PHP7 allowed for strict return types.

Proposed resolution

Adding an assert() here improves debugability

Remaining tasks

None

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A


Viewing all articles
Browse latest Browse all 296466

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>