Grouped exposed taxonomy term filters does not work when input from user is an array.

Created on 3 May 2023, over 1 year ago

Problem/Motivation

Illegal offset type is an array.

The website encountered an unexpected error. Please try again later.
TypeError: Illegal offset type in isset or empty in Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid->validateExposed() (line 366 of core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php).
Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid->validateExposed(Array, Object) (Line: 169)
Drupal\views\Form\ViewsExposedForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'views_exposed_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('views_exposed_form', Array, Object) (Line: 588)
Drupal\Core\Form\FormBuilder->processForm('views_exposed_form', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm('\Drupal\views\Form\ViewsExposedForm', Object) (Line: 134)
Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase->renderExposedForm() (Line: 1241)
Drupal\views\ViewExecutable->build() (Line: 392)
Drupal\views\Plugin\views\display\PathPluginBase->execute() (Line: 196)
Drupal\views\Plugin\views\display\Page->execute() (Line: 1633)
Drupal\views\ViewExecutable->executeDisplay('page_1', Array) (Line: 81)
Drupal\views\Element\View::preRenderViewElement(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: 772)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 363)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
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: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

The view has two exposed grouped taxonomy filters.

        field_term_target_id:
          id: field_term_target_id
          table: node__field_term
          field: field_term_target_id
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: taxonomy_index_tid
          operator: or
          value: {  }
          group: 1
          exposed: true
          expose:
            operator_id: field_term_target_id_op
            label: 'Label 1'
            description: null
            use_operator: false
            operator: field_term_target_id_op
            operator_limit_selection: false
            operator_list: {  }
            identifier: field_term_target_id
            required: false
            remember: false
            multiple: true
            remember_roles:
              authenticated: authenticated
            reduce: false
          is_grouped: true
          group_info:
            label: 'Group Label 1'
            description: ''
            identifier: field_term_target_id
            optional: true
            widget: select
            multiple: true
            remember: false
            default_group: All
            default_group_multiple: {  }
            group_items:
              1:
                title: 'Title 1'
                operator: or
                value:
                  614: '614'
                  245: '245'
                  762: '762'
                  757: '757'
                  758: '758'
                  759: '759'
                  760: '760'
                  763: '763'
                  761: '761'
                  246: '246'
                  244: '244'
              2:
                title: 'Title 2'
                operator: or
                value:
                  247: '247'
                  677: '677'
              3:
                title: 'Title 3'
                operator: or
                value:
                  263: '263'
                  687: '687'
                  691: '691'
                  703: '703'
                  698: '698'
                  718: '718'
                  720: '720'
                  795: '795'
                  708: '708'
                  713: '713'
                  692: '692'
                  707: '707'
                  699: '699'
                  721: '721'
                  800: '800'
                  709: '709'
                  715: '715'
                  794: '794'
                  796: '796'
                  797: '797'
                  793: '793'
                  798: '798'
                  799: '799'
                  801: '801'
                  776: '776'
                  777: '777'
                  693: '693'
                  700: '700'
                  706: '706'
                  714: '714'
                  710: '710'
                  694: '694'
                  701: '701'
                  704: '704'
                  716: '716'
                  711: '711'
                  695: '695'
                  705: '705'
                  702: '702'
                  717: '717'
                  712: '712'
                  678: '678'
                  264: '264'
                  265: '265'
                  680: '680'
                  266: '266'
                  644: '644'
                  267: '267'
                  682: '682'
                  268: '268'
                  683: '683'
              4:
                title: 'Title 4'
                operator: or
                value:
                  253: '253'
                  730: '730'
                  733: '733'
                  734: '734'
                  735: '735'
                  731: '731'
                  736: '736'
                  737: '737'
                  738: '738'
                  732: '732'
                  739: '739'
                  740: '740'
                  254: '254'
                  255: '255'
                  256: '256'
                  257: '257'
                  258: '258'
                  259: '259'
                  260: '260'
                  261: '261'
                  262: '262'
              5:
                title: 'Title 5'
                operator: or
                value:
                  248: '248'
                  722: '722'
                  723: '723'
                  250: '250'
                  251: '251'
                  779: '779'
                  780: '780'
                  781: '781'
                  782: '782'
                  783: '783'
                  726: '726'
                  792: '792'
                  249: '249'
                  728: '728'
                  727: '727'
                  729: '729'
                  785: '785'
                  786: '786'
                  787: '787'
                  788: '788'
                  789: '789'
                  725: '725'
                  252: '252'
              6:
                title: 'Title 6'
                operator: or
                value:
                  269: '269'
                  741: '741'
                  744: '744'
                  765: '765'
                  745: '745'
                  746: '746'
                  742: '742'
                  747: '747'
                  803: '803'
                  748: '748'
                  749: '749'
                  750: '750'
                  802: '802'
                  743: '743'
                  751: '751'
                  752: '752'
                  753: '753'
                  754: '754'
                  755: '755'
                  681: '681'
                  270: '270'
                  271: '271'
                  275: '275'
                  276: '276'
                  272: '272'
                  670: '670'
                  675: '675'
                  669: '669'
                  645: '645'
                  273: '273'
                  274: '274'
              7:
                title: 'Title 7'
                operator: or
                value:
                  620: '620'
                  769: '769'
                  621: '621'
                  622: '622'
                  623: '623'
                  624: '624'
                  625: '625'
                  626: '626'
                  632: '632'
                  630: '630'
                  633: '633'
                  631: '631'
                  672: '672'
          reduce_duplicates: false
          vid: test_vocabulary
          type: select
          hierarchy: true
          limit: true
          error_message: true
          save_lineage: false
          force_deepest: false
          parent: 0
          level_labels: ''
          hierarchy_depth: 0
          required_depth: 0

and

        field_term_2_target_id:
          id: field_term_2_target_id
          table: node__field_term
          field: field_term_2_target_id
          relationship: none
          group_type: group
          admin_label: ''
          plugin_id: taxonomy_index_tid
          operator: or
          value: {  }
          group: 1
          exposed: true
          expose:
            operator_id: field_term_2_target_id_op
            label: 'Label 2'
            description: ''
            use_operator: false
            operator: field_term_2_target_id_op
            operator_limit_selection: false
            operator_list: {  }
            identifier:field_term_2_target_id
            required: false
            remember: false
            multiple: false
            remember_roles:
              authenticated: authenticated
            reduce: false
          is_grouped: true
          group_info:
            label: 'Group Label 2'
            description: ''
            identifier: field_term_2_target_id
            optional: true
            widget: select
            multiple: true
            remember: false
            default_group: All
            default_group_multiple: {  }
            group_items:
              1:
                title: 'Title 1'
                operator: not
                value:
                  628: '628'
              2:
                title: 'Title 2'
                operator: not
                value:
                  627: '627'
          reduce_duplicates: false
          vid: test_vocabulary_2
          type: select
          hierarchy: false
          limit: true
          error_message: true
          save_lineage: false
          force_deepest: false
          parent: 0
          level_labels: ''
          hierarchy_depth: 0
          required_depth: 0

Proposed resolution

Apply patch to cope if array is returned.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

๐Ÿ› Bug report
Status

Needs review

Version

9.4

Component
Taxonomyย  โ†’

Last updated 1 day ago

  • Maintained by
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States @xjm
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @catch
Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom somersoft

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024