TypeError: Cannot access offset of type string on string in Drupal\Component\Utility\NestedArray::setValue()

Created on 26 July 2022, about 2 years ago
Updated 19 June 2024, 3 months ago

I have this error in logs:

The website encountered an unexpected error. Please try again later.
TypeError: Cannot access offset of type string on string in Drupal\Component\Utility\NestedArray::setValue() (line 155 of core/lib/Drupal/Component/Utility/NestedArray.php).

Drupal\Component\Utility\NestedArray::setValue(Array, Array, NULL) (Line: 1249)
Drupal\Core\Form\FormBuilder->handleInputElement('views_exposed_form', Array, Object) (Line: 1000)
Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 1070)
Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 1070)
Drupal\Core\Form\FormBuilder->doBuildForm('views_exposed_form', Array, Object) (Line: 574)
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: 1238)
Drupal\views\ViewExecutable->build() (Line: 392)
Drupal\views\Plugin\views\display\PathPluginBase->execute() (Line: 196)
Drupal\views\Plugin\views\display\Page->execute() (Line: 1630)
Drupal\views\ViewExecutable->executeDisplay('page_1', Array) (Line: 198)
Drupal\tvi\Service\TaxonomyViewsIntegratorManager->getTaxonomyTermView(Object) (Line: 50)
Drupal\tvi\Controller\TaxonomyViewsIntegratorTermPageController->render(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
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: 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)

I get a path like this while using BEF: http://mysite/cakes?design[with-flowers]=with-flowers&tires[2]=2

Everything works. But in logs I have error on this path: http://mysite/cakes?design=with-flowers&tires=2
So like the upper path but without square brackets.

Not sure if this error is related to the BEF module.

๐Ÿ› Bug report
Status

Closed: duplicate

Version

7.0

Component

Code

Created by

๐Ÿ‡ท๐Ÿ‡บRussia kazah

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.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly Kris77

    This error, for me, appear when press enter key and not click on button.

  • Status changed to Postponed: needs info 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia GuillaumeG

    Hi,

    I can replicate this issue on a vanilla Drupal installation:

    1. Install Drupal 10 and enable the Better Exposed Filters module
    2. Create a new Drupal view listing Articles
    3. Add a new tags filter
      1. Set the Selection type to dropdown
      2. Check "Expose this filter to visitors" to allow them to change it
      3. Click "Allow multiple selections"
      4. Apply the changes
    4. In the Advanced tab under "Exposed form style", select "Better Exposed Filters"
    5. For the Exposed filter "field_tags_target_id" with label "Tags (field_tags)", choose "Checkboxes / Radio buttons" for the Exposed filter widget
    6. Save the view
    7. Visit the View page and append /articles-list?field_tags_target_id=All (any other values will result in the same error).

    Upon accessing the website, the following error occurs:

    The website encountered an unexpected error. Please try again later.
    Error: Cannot create references to/from string offsets in Drupal\Component\Utility\NestedArray::setValue() (line 155 of core/lib/Drupal/Component/Utility/NestedArray.php).

    The following Drupal core patch fixes the issue https://www.drupal.org/project/drupal/issues/3023924#comment-14841300 ๐Ÿ› Cannot create references to/from string offsets Needs work but not quite sure this is a core or a BEF issue at this stage.

  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Ideally this would be fixed in core.

    Can see if we can put in another on this side to help, most likely itโ€™ll be dependent on core though.

    If we determine we canโ€™t do anything can put a note on the modules page for known issues.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
  • Status changed to Closed: duplicate 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    So unfortunately I don't believe there is anything we can on this side to fix the problem. Also verified that patch on core fixes the issue so left a comment to maybe help shake it loose but encourage others to get involved with it.

Production build 0.71.5 2024