- Issue created by @SocialNicheGuru
The ajax_big_pipe module incorrectly calls `BlockViewBuilder::lazyBuilder()` with 3 parameters when it only accepts 2, causing an ArgumentCountError when the lazy builder callback is executed.
Drupal 10.5.x
php8.3
In `ajax_big_pipe.module` at line 40-47, the module sets up a lazy builder like this:
$build['#lazy_builder'] = [
BlockViewBuilder::class . '::lazyBuilder',
[
'id' => $entityId, // Problem 1: Using named array keys
'mode' => 'full', // Problem 2: Using named array keys
'params' => json_encode($visible['ajax_big_pipe_condition']), // Problem 3: Extra parameter
],
];
However, the core `BlockViewBuilder::lazyBuilder()` method only accepts 2 parameters:
public static function lazyBuilder($entity_id, $view_mode) {
return static::buildPreRenderableBlock(Block::load($entity_id), \Drupal::service('module_handler'));
}
1. Install Drupal 10.5.x with ajax_big_pipe module
2. Configure a block to use ajax_big_pipe by enabling "Use Ajax Big Pipe" in the block's visibility settings
3. View a page containing that block
4. When the lazy builder callback executes, you'll get an error:
1. Named array keys: The module is passing an associative array with keys 'id', 'mode', 'params' instead of a numeric array
2. Wrong parameter count: Passing 3 parameters when the method only accepts 2
3. Unused implementation: The module has its own `LazyBlockBuilder::lazyBlockBuild()` method but it's just a stub that returns markup instead of rendering the block
The module appears to have started implementing its own lazy builder infrastructure, falling back to incorrectly using core's BlockViewBuilder.
Option 1: Fix the parameters
Option 2: Complete the LazyBlockBuilder implementation
Option 3: Use a different approach:
Since the module is trying to implement BigPipe functionality for blocks, consider using Drupal's built-in BigPipe module patterns instead of custom lazy builders.
Active
1.0
Code