Notice: Debug: Drupal\Core\Render\Renderer::render with $is_root_call is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. After upgrading to Drupal 11.2

Created on 21 June 2025, 4 days ago

Problem/Motivation

After upgrading to Drupal 11.2 I get the following notice:

Debug: Drupal\Core\Render\Renderer::render with $is_root_call is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use Drupal\Core\Render\Renderer::renderRoot() instead. See https://www.drupal.org/node/3497318. in Drupal\Core\Render\Renderer->render() (line 218 of core/lib/Drupal/Core/Render/Renderer.php).

Steps to reproduce

Upgrade to Drupal 11.2 and visit a page that uses the drupal/leaflet module.

🐛 Bug report
Status

Active

Version

10.3

Component

Code

Created by

🇧🇪Belgium f0ns

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @f0ns
  • 🇧🇪Belgium gillesbailleux La Roche-en-Ardenne

    Experiencing the same issue:
    User notice : Drupal\Core\Render\Renderer::render with $is_root_call is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use Drupal\Core\Render\Renderer::renderRoot() instead. See https://www.drupal.org/node/3497318. dans Drupal\Core\Render\Renderer->render() (/home/USER/public_html/web/core/lib/Drupal/Core/Render/Renderer.php ligne 218)

    Here are the messages in dblog

    #0 /home/USER/public_html/web/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
    #1 [internal function]: _drupal_error_handler()
    #2 /home/USER/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(218): trigger_error()
    #3 /home/USER/public_html/web/modules/contrib/leaflet/src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php(554): Drupal\Core\Render\Renderer->render()
    #4 /home/USER/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(622): Drupal\leaflet\Plugin\Field\FieldFormatter\LeafletDefaultFormatter->{closure:Drupal\leaflet\Plugin\Field\FieldFormatter\LeafletDefaultFormatter::tokenResolvedContent():553}()
    #5 /home/USER/public_html/web/modules/contrib/leaflet/src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php(553): Drupal\Core\Render\Renderer->executeInRenderContext()
    #6 /home/USER/public_html/web/modules/contrib/leaflet/src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php(358): Drupal\leaflet\Plugin\Field\FieldFormatter\LeafletDefaultFormatter->tokenResolvedContent()
    #7 /home/USER/public_html/web/core/lib/Drupal/Core/Field/FormatterBase.php(91): Drupal\leaflet\Plugin\Field\FieldFormatter\LeafletDefaultFormatter->viewElements()
    #8 /home/USER/public_html/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(275): Drupal\Core\Field\FormatterBase->view()
    #9 /home/USER/public_html/web/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(288): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple()
    #10 /home/USER/public_html/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(341): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple()
    #11 /home/USER/public_html/web/core/modules/node/src/NodeViewBuilder.php(29): Drupal\Core\Entity\EntityViewBuilder->buildComponents()
    #12 /home/USER/public_html/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(283): Drupal\node\NodeViewBuilder->buildComponents()
    #13 /home/USER/public_html/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(240): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
    #14 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
    #15 /home/USER/public_html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(107): call_user_func_array()
    #16 /home/USER/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(871): Drupal\Core\Render\Renderer->doTrustedCallback()
    #17 /home/USER/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(433): Drupal\Core\Render\Renderer->doCallback()
    #18 /home/USER/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(222): Drupal\Core\Render\Renderer->doRender()
    #19 /home/USER/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
    #20 /home/USER/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(622): Drupal\Core\Render\MainContent\HtmlRenderer->{closure:Drupal\Core\Render\MainContent\HtmlRenderer::prepare():235}()
    #21 /home/USER/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(235): Drupal\Core\Render\Renderer->executeInRenderContext()
    #22 /home/USER/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(131): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
    #23 /home/USER/public_html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
    #24 /home/USER/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    #25 /home/USER/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}()
    #26 /home/USER/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
    #27 /home/USER/public_html/vendor/symfony/http-kernel/HttpKernel.php(188): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
    #28 /home/USER/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #29 /home/USER/public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
    #30 /home/USER/public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #31 /home/USER/public_html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #32 /home/USER/public_html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #33 /home/USER/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(201): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #34 /home/USER/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(138): Drupal\page_cache\StackMiddleware\PageCache->fetch()
    #35 /home/USER/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(87): Drupal\page_cache\StackMiddleware\PageCache->lookup()
    #36 /home/USER/public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #37 /home/USER/public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #38 /home/USER/public_html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #39 /home/USER/public_html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #40 /home/USER/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #41 /home/USER/public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
    #42 {main}
    
  • 🇧🇪Belgium f0ns

    Can you test with the provided patches if it also fixes it for you? Here everything works now. Thanks!

  • Pipeline finished with Success
    3 days ago
    Total: 233s
    #528150
  • 🇮🇹Italy itamair

    Ehi @f0ns shouldn't also this same $this->renderer->render (with $is_root_call === TRUE) here:

    https://git.drupalcode.org/project/leaflet/-/blob/10.2.x/modules/leaflet...

    be fixed in the same way?

  • 🇮🇹Italy itamair

    Also I had to change the target branch from 10.2.x to 10.3.x ... (be more carful with all this please, guys).

    • itamair committed 65363711 on 10.3.x
      Fixed / Refactored render methods without $is_root_call (=== TRUE)
      ('...
  • 🇮🇹Italy itamair

    I further tested the actual MR!59 state and the following fix:

    $this->renderer->renderRoot($elements)

    was always causing the following Exception:

    LogicException: A stray renderRoot() invocation is causing bubbling of attached assets to break. in Drupal\Core\Render\Renderer->renderRoot() (line 105 of /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php).

    In the end the fix to this looks as simple as simply omitting the render $is_root_call = TRUE param.

    Closing all this as the lates https://git.drupalcode.org/project/leaflet/-/commit/65363711efec28463179... commit is (looks) fixing all this.

    Deploying a new 10.3.2 with this, and crediting @f0ns just for this reporting (though his fix didn't work to me).

  • 🇧🇪Belgium gillesbailleux La Roche-en-Ardenne

    Confirming that leaflet v10.3.3 fixes the issue. Thank you very much and please pardon me for not paying attention to the target branch.

  • 🇧🇪Belgium f0ns

    Thank you sir and sorry for the extra hassle. Have a great day and thank you for the new release.

Production build 0.71.5 2024