Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When looking at the view for the first time or after clearing the cache I see the following error:
Warning: implode(): Invalid arguments passed in Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::buildRouteIdentifier() (line 168 of modules/contrib/views_menu_children_filter/src/Plugin/views/argument/MenuChildren.php).
Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::buildRouteIdentifier('main', 'view.support.page_1', Array) (Line: 130)
Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::getMenuLinkFromTargetUrl(Array, Object) (Line: 87)
Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren::filterChildrenNodeByParent(Object, 'support', Array) (Line: 74)
Drupal\views_menu_children_filter\Plugin\views\argument\MenuChildren->query() (Line: 1099)
Drupal\views\ViewExecutable->_buildArguments() (Line: 1253)
Drupal\views\ViewExecutable->build() (Line: 390)
Drupal\views\Plugin\views\display\PathPluginBase->execute() (Line: 168)
Drupal\views\Plugin\views\display\Page->execute() (Line: 1616)
Drupal\views\ViewExecutable->executeDisplay('page_1', Array) (Line: 78)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func(Array, Array) (Line: 376)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 149)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
This appears to be because $route_parameters
can be empty.
Proposed resolution
Check the variable that is passed to implode()
for empty-ness.
Comment | File | Size | Author |
---|---|---|---|
#2 | warning_implode_-2897796-2.patch | 1014 bytes | John Cook |
Comments
Comment #2
John Cook CreditAttribution: John Cook at Creode commentedI've added the check in buildRouteIdentifier().
Comment #4
cravecode CreditAttribution: cravecode commentedThanks for the patch @John. I'll be honest, I haven't tested it. The patch looks innocent enough to me, so I committed it.
Comment #5
John Cook CreditAttribution: John Cook at Creode commentedI'm assuming it's fixed ;)