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
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 3244956-9.4.x-21.patch | 3.18 KB | didebru |
| #20 | 3244956-20.patch | 3.18 KB | didebru |
| #17 | 3244956-17.patch | 789 bytes | narendra.rajwar27 |
| #15 | interdiff_10_15.txt | 776 bytes | ameymudras |
| #15 | 3244956-15.patch | 832 bytes | ameymudras |
Issue fork drupal-3244956
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
afschComment #3
cilefen commentedWe'll need steps to reproduce and failing automated test to reveal a bug in core. Also Drupal 8 is end of life in two weeks.
Comment #4
cilefen commentedPlease get a stack trace too.
Comment #5
afschUpdating the temporal patch.
Comment #6
lendude@alexis_saransig as @cilefen pointed out, could you provide some steps to reproduce this with just Drupal core? Usually these kinds of errors come from badly setup code elsewhere (as you pointed out in de issue summary this could be related to Quicktabs) and we don't want to hide these warnings because they are doing their job, warning against bad code.
Comment #10
t_stallmann commentedI ran into this issue but in a different line of code in the module. Steps to reproduce are as follows:
* 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.
Comment #12
t_stallmann commentedComment #13
cilefen commentedIt would be great if the steps to reproduce were in the issue summary.
Comment #14
ameymudras commentedComment #15
ameymudras commentedTested the above patch with Drupal 9.5 and php 8 and I was still facing an issue:
I have made changes to the patch to fix the issue
Comment #17
narendra.rajwar27Trying to fix failed test cases.
Comment #18
lendudeWe still need some steps to reproduce in the IS please.Edit: Oops completely scanned over them! Thanks for adding those!
Also we need an automated test for this, since we are changing logic and the patch in #17 is doing something different than the patch in #12 which was preventing the fatal error apparently.
Comment #20
didebruI've faced that issue when I create an exposed filter for a boolean field with any as default.
Comment #21
didebruReroll for 9.4.x
Comment #22
didebruComment #23
didebruTest only.
Comment #24
didebruComment #25
didebruComment #27
didebruComment #28
didebruComment #29
la558 commentedI'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
However, I edited patch 17 adjusting the line numbers and it worked
Thanks!
Comment #31
pfrenssen@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.
Comment #33
liquidcms commentedI was trying to make a view of a simple bundle that had a multivalue field and use aggregation to count (field) the number of items and filter on counts being > X. When i added count filter the view crashed. I get a WSOD with:
TypeError: Cannot access offset of type string on string in Drupal\views\Plugin\views\filter\NumericFilter->adminSummary() (line 413 of E:\www\dev\web\core\modules\views\src\Plugin\views\filter\NumericFilter.php).
when i try to add it and from the point on my view is corrupt. Adding this patch allows me to edit the view again.
Sadly, i am still not able to filter on count.