Illegal string offset 'value' in Drupal\views\Plugin\views\filter\NumericFilter

Created on 20 October 2021, about 3 years ago
Updated 28 August 2023, over 1 year ago

Problem/Motivation

There is a warning message where views are loaded. I was not able to find the origin of this but I'm guessing this could be related to Quicktabs (alpha5).

Warning: Illegal string offset 'value' in Drupal\views\Plugin\views\filter\NumericFilter->valueForm() (line 256 of core/modules/views/src/Plugin/views/filter/NumericFilter.php).

Steps to reproduce

* Create a view of content items
* Enable aggregation
* For the default filter criteria "Content: Published = "Yes", under aggregation settings, change "Group results together" to any of the aggregation operators. Note this is not usually something you would want to do, but the UI does let you do it. You will get an an AJAX error, and the dialog box that pops up won't close, so you'll need to manually close the dialog box.
* Try saving the view
* At this point you'll be in an unrecoverable WSOD any time you try to edit the view, because the `adminSummary` for that status field will throw the error cited here. It's particularly annoying because there's no way to actually fix the error that I've found short of deleting the view and re-creating it. I had to patch my code locally just in order to get back to the View edit interface and change the aggregation settings back to a working value.

Proposed resolution

Created a patch with a solution that verified if the variable is set or not.

Remaining tasks

Tests

User interface changes

NA

API changes

NA

Data model changes

NA

Release notes snippet

NA

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated 30 minutes ago

Created by

πŸ‡ͺπŸ‡¨Ecuador afsch Otavalo

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • I'm facing this problem as well; unfortunately, none of the above patches worked for me.
    Drupal: 9.5.9
    PHP: 8.1.17
    MySQL: 8.0.30

    TypeError: Cannot access offset of type string on string in Drupal\views\Plugin\views\filter\NumericFilter->adminSummary() 
    (line 396 of /web/core/modules/views/src/Plugin/views/filter/NumericFilter.php)

    Any suggestion?

  • πŸ‡§πŸ‡¬Bulgaria pfrenssen Sofia

    @La558, your proposed line change is already included in the patch from #27, it is recommended to try testing the latest patch first, rather than going back to older revisions of the patch.

    @DiDebru, thanks for adding some test coverage! It seems to need some more work though, since the test-only version of the patch is supposed to have a failure indicating the bug.

  • last update over 1 year ago
    30,060 pass
  • @pfrenssen opened merge request.
Production build 0.71.5 2024