2

I'm running against a fatal error on an number of CiviCRM pages (stacktrace below). There seems to be a problem with a url that is passed to Drupal\Core\Url::fromUserInput() when building the CiviCRM breadcrumb.

My setup: Drupal 9.1.5 (multilingual nl and fr) CiviCRM 5.35.0

Any ideas?

Thanks.

UPDATE: I've updated the stacktrace in response of the answer of Demerit. I've switched to core Bartik theme instead of my custom theme and experience the same error.

Er is onverwacht een fout opgetreden. Probeer het later nog eens.

InvalidArgumentException: The user-entered string 'https://nl.example.be.lndo.site/civicrm?reset=1' must begin with a '/', '?', or '#'. in Drupal\Core\Url::fromUserInput() (line 213 of core/lib/Drupal/Core/Url.php).

Drupal\civicrm\CivicrmBreadcrumbBuilder->build(Object) (Line: 83)
Drupal\Core\Breadcrumb\BreadcrumbManager->build(Object) (Line: 72)
Drupal\system\Plugin\Block\SystemBreadcrumbBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 781)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 372)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 450)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 90)
__TwigTemplate_7936d95d2109e2f3d9c3238b3a2874dfc12656eb43b3c81bb3249b679af13b6d->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 65)
twig_render_template('core/themes/bartik/templates/page.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 450)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 86)
__TwigTemplate_7a63433aced4475eeba9239a5c5c71c161379c0b5254aa839ee30a407195e9cd->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 65)
twig_render_template('core/themes/bartik/templates/classy/layout/html.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 431)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array) (Line: 162)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 163)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

4
  • This part is strange Drupal\civicrm\CivicrmBreadcrumbBuilder->build(Object) (Line: 83) because there is no line 83 in that file (src/CivicrmBreadcrumbBuilder.php). Do you have any customizations?
    – Demerit
    Mar 15 at 15:47
  • This is strange indeed. I'm using a fresh CiviCRM install with no customizations. The build function is line 59 of src/CivicrmBreadcrumbBuilder.
    – cray146
    Mar 17 at 9:04
  • Ok, another clue then is http://d9.example.be.lndo.site:/bin/civicrm?reset=1 is a very strange looking url. I'd double-check your settings in civicrm.settings.php and at civicrm/admin/setting/path and civicrm/admin/setting/url.
    – Demerit
    Mar 17 at 16:14
  • True, the strange looking path went away by resetting paths. The problem continues though and drupal complains about a valid URL (see updated stacktrace). Seems like drupal does not expect the CIVICRM_UF_BASEURL is part of the url that is passed to the function.
    – cray146
    Mar 19 at 11:39
1

I think the problem is in your custom theme:

wig_render_template('themes/custom/b4_piosite/templates/page.html.twig', Array) (Line: 384)

It's doing something that this doesn't like:

Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725

1
  • Thanks for your valuable input. I've switched back to core Bartik and still experience the error. I've updated the stacktrace in my original post.
    – cray146
    Mar 17 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.