Add assertion for #lazy_builder callback argument

Created on 18 February 2022, almost 3 years ago
Updated 6 February 2023, almost 2 years ago

Problem/Motivation

Follow-up to #3265121-6: Remove Symfony 4 RequestStack BC shim in 11.0.x β†’

Steps to reproduce

Run core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php

Failed asserting that exception of type "ArgumentCountError" matches expected exception "AssertionError". Message was: "Too few arguments to function Drupal\Tests\Core\Render\RecursivePlaceholdersTest::callback(), 0 passed and exactly 1 expected" at
/var/www/html/web/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php:1173
/var/www/html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php:101
/var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php:775
/var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php:345
/var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php:201
/var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php:145
/var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php:567
/var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php:146
/var/www/html/web/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php:952

Proposed resolution

- add assertion and improve tests
- prevent calling \Drupal\Core\Render\Renderer::doCallback() with wrong argument

Remaining tasks

- agree on fix
- review/commit

User interface changes

API changes

no

Data model changes

no

Release notes snippet

no

πŸ“Œ Task
Status

Fixed

Version

10.1 ✨

Component
RenderΒ  β†’

Last updated about 8 hours ago

Created by

πŸ‡«πŸ‡·France andypost

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024