Warning: Undefined array key "#type" in Drupal\\better_exposed_filters\\Plugin\\better_exposed_filters\\filterDatePickers->exposedFormAlter() (line 65 of /var/www/html/web/modules/contrib/better_exposed_filters/src/Plugin/better_exposed_filters/filter/Dat

Created on 29 August 2024, 4 months ago

In a Drupal 10.2 (and now in 10.3) installation, we reported a warning with BEF

Warning: Undefined array key "#type" in Drupal\\better_exposed_filters\\Plugin\\better_exposed_filters\\filterDatePickers->exposedFormAlter() (line 65 of /var/www/html/web/modules/contrib/better_exposed_filters/src/Plugin/better_exposed_filters/filter/DatePickers.php

$element['min']['#type'] is expected but in some cases, the "#type" is on $element['min']['date']['#type']

πŸ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain escuriola

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

Merge Requests

Comments & Activities

  • Issue created by @escuriola
  • Merge request !101Resolve #3470965 "Warning undefined array" β†’ (Closed) created by escuriola
  • Pipeline finished with Success
    4 months ago
    Total: 190s
    #268136
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Fixes should be against 7.0.x first and verified there too

    Will need steps

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    need to confirm if an issue in 7.0.x

    And exact steps to reproduce.

  • πŸ‡¨πŸ‡¦Canada ebremner

    So I can confirm that this is still an issue with 6.0.6 and 7.1.0. We are using smart date and if you use an exposed filter on the date that uses smart date, in D9.5 we get the following error:

    Warning: Undefined array key "type" in Drupal\Core\Render\Element\Date::processDate() (line 71 of core/lib/Drupal/Core/Render/Element/Date.php).
    
    Drupal\Core\Render\Element\Date::processDate(Array, Object, Array)
    call_user_func_array(Array, Array) (Line: 1012)
    Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 1075)
    Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 1075)
    Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 1075)
    Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 1075)
    Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 579)
    Drupal\Core\Form\FormBuilder->processForm('views_exposed_form', Array, Object) (Line: 325)
    Drupal\Core\Form\FormBuilder->buildForm('\Drupal\views\Form\ViewsExposedForm', Object) (Line: 134)
    Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase->renderExposedForm() (Line: 1243)
    Drupal\views\ViewExecutable->build('news_page') (Line: 1396)
    Drupal\views\ViewExecutable->execute('news_page') (Line: 343)
    Drupal\uw_custom_blocks\Plugin\Block\UwCblMultiTypeList->getNodes('News', 3, ) (Line: 144)
    Drupal\uw_custom_blocks\Plugin\Block\UwCblMultiTypeList->build() (Line: 106)
    Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender(Object, 'section_component.build.render_array', Object)
    call_user_func(Array, Object, 'section_component.build.render_array', Object) (Line: 142)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'section_component.build.render_array') (Line: 90)
    Drupal\layout_builder\SectionComponent->toRenderArray(Array, ) (Line: 88)
    Drupal\layout_builder\Section->toRenderArray(Array) (Line: 316)
    Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildSections(Object) (Line: 275)
    Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple(Array) (Line: 340)
    Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 24)
    Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 282)
    Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 239)
    Drupal\Core\Entity\EntityViewBuilder->build(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: 788)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array, ) (Line: 242)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 243)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
    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: 174)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 191)
    Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 128)
    Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 82)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So 7.0.x is D10 and up did you try on that? D9 is actually no longer supported core branch.

  • πŸ‡¨πŸ‡¦Canada ebremner

    Yes I tried both and both caused the same error. 6.0.6 for D9 and 7.01 for D10. Actually changed the core version requirement for 7.0.1 in D9 and everything seemed ok, except for this error that we are getting.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    But does it not seem incorrect that type is not set? Don't want to put a check just to make a warning go away if there is incorrect code somewhere.

  • Status changed to Postponed: needs info about 1 month ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
Production build 0.71.5 2024