User error: "0" is an invalid render array key in Drupal\Core\Render\Element::children()

Created on 19 December 2019, about 5 years ago
Updated 2 August 2024, 5 months ago

Steps to reproduce

  1. Install Drupal 8.8.1
  2. drush en -y media_library
  3. Create media type "Remote video" with these settings β†’
  4. Create some CT with a field making use of Media Library and allowing media type "Remote video"
  5. In node form, click on field to open Media Library modal
  6. If you have multiple media types, make sure you click on "Remote video" tab in modal


Current result

  • DBlog logs :
  • User error: "0" is an invalid render array key in Drupal\Core\Render\Element::children() (line 97 of /var/www/html/web/core/lib/Drupal/Core/Render/Element.php) #0 /var/www/html/web/core/includes/bootstrap.inc(596): _drupal_error_handler_real(256, '"0" is an inval...', '/var/www/html/w...', 97, Array) #1 [internal function]: _drupal_error_handler(256, '"0" is an inval...', '/var/www/html/w...', 97, Array) #2 /var/www/html/web/core/lib/Drupal/Core/Render/Element.php(97): trigger_error('"0" is an inval...', 256) #3 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(402): Drupal\Core\Render\Element::children(Array, false) #4 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(444): Drupal\Core\Render\Renderer->doRender(Array) #5 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(444): Drupal\Core\Render\Renderer->doRender(Array) #6 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(444): Drupal\Core\Render\Renderer->doRender(Array) #7 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender(Array, false) #8 /var/www/html/web/core/lib/Drupal/Core/Template/TwigExtension.php(501): Drupal\Core\Render\Renderer->render(Array) #9 /var/www/html/web/sites/default/files/php/twig/5dfb4cb1a9345_media-library-wrapper.htm_f_JYNvTTrDG9miX3e2bneaS03/H_KnDp_1rc6iXO_SkhJbWRntrV_j5n1nyTPPE_UaW3g.php(64): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true) #10 /var/www/html/vendor/twig/twig/src/Template.php(455): __TwigTemplate_b883481b98094281f15633095b8d30955b6dbe2479a50f1c3d2fd27f11228de9->doDisplay(Array, Array) #11 /var/www/html/vendor/twig/twig/src/Template.php(422): Twig\Template->displayWithErrorHandling(Array, Array) #12 /var/www/html/vendor/twig/twig/src/Template.php(434): Twig\Template->display(Array) #13 /var/www/html/web/core/themes/engines/twig/twig.engine(64): Twig\Template->render(Array) #14 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('core/themes/cla...', Array) #15 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(431): Drupal\Core\Theme\ThemeManager->render('media_library_w...', Array) #16 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender(Array, true) #17 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(144): Drupal\Core\Render\Renderer->render(Array, true) #18 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() #19 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(145): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #20 /var/www/html/web/core/lib/Drupal/Core/Ajax/CommandWithAttachedAssetsTrait.php(36): Drupal\Core\Render\Renderer->renderRoot(Array) #21 /var/www/html/web/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php(135): Drupal\Core\Ajax\OpenDialogCommand->getRenderedContent() #22 /var/www/html/web/core/lib/Drupal/Core/Ajax/AjaxResponse.php(43): Drupal\Core\Ajax\OpenDialogCommand->render() #23 /var/www/html/web/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php(776): Drupal\Core\Ajax\AjaxResponse->addCommand(Object(Drupal\Core\Ajax\OpenModalDialogCommand)) #24 [internal function]: Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::openMediaLibrary(Array, Object(Drupal\Core\Form\FormState), Object(Symfony\Component\HttpFoundation\Request)) #25 /var/www/html/web/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php(69): call_user_func_array(Array, Array) #26 /var/www/html/web/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php(109): Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse(Object(Symfony\Component\HttpFoundation\Request), Array, Object(Drupal\Core\Form\FormState), Array) #27 [internal function]: Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException(Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #28 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #29 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(227): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exceptio...', Object(Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent)) #30 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(79): Symfony\Component\HttpKernel\HttpKernel->handleException(Object(Drupal\Core\Form\FormAjaxException), Object(Symfony\Component\HttpFoundation\Request), 1) #31 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #36 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #37 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(694): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #39 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #40 {main}.
    


Expected result

  • Displaying Media Library modal should not throw any error

 

Todo

  • Debug and fix
πŸ› Bug report
Status

Closed: duplicate

Version

8.8 ⚰️

Component
MediaΒ  β†’

Last updated 1 day ago

Created by

πŸ‡«πŸ‡·France davidferlay

Live updates comments and jobs are added and updated live.
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