For anybody experiencing problems, please open an issue for this so we can address it there. Feel free to post a link to the follow up here so people that worked on this issue might help out with the follow up too.
In all cases so far this was due to a contrib module not properly declaring a config for a custom Views filter. So look at your filter and see if it uses something from a contrib. If so open up an issue there or otherwise open up a new issue for core and we can look at it there.
Problem/Motivation
When using a grouped filter in a View that is not 'string' based, saving the view gives an "Error" page with message "InvalidArgumentException: The configuration property display.default.display_options.filters.created.group_info.group_items.1.value.type doesn't exist. in Drupal\Core\Config\Schema\Mapping->get() (line 66 of core/lib/Drupal/Core/Config/Schema/Mapping.php)".
This is all due to the fact that the grouped filter value schema is always a string.
This applies for example to Date, Datetime, numeric and Boolean grouped fields.
Major bug according to https://www.drupal.org/core/issue-priority#major-bug
Trigger a PHP error through the user interface, but only under rare circumstances or affecting only a small percentage of all users, even if there is a workaround.
Other Issues
#2576927: Grouped exposed taxonomy filter fails validation for autocomplete widget (not strictly postponed) has a test of the preview, but not a test of save cause of this issue.
#2648950: [PP-2] Use form element of type date instead textfield when selecting a date in an exposed filter is postponed on this issue.
#2049603: Exposed Group Filter assigns incorrect tid to SQL Query is postponed on this issue.
Proposed resolution
Update the handling of the grouped filter type in the code to allow for configuration to set other value types than strings. Then update the views filter Schema to set non-string grouped filter values where needed.
Note: We hope we fix all schema errors in this issue, but there might be still some obscure ones left. We can always add new issues and fix the other ones, but in the meantime solve the problem for people out there.
Steps to reproduce
Create a content view with a filter "Content: Authored On". Expose the filter and select "Grouped filters". Create a group with value type "A date..." and another group with "An offset..." selected, click "Apply".
Go back to edit the filter. Both groups now have value type "A date..." selected.
Saving the view gives an "Error" page with message "InvalidArgumentException: The configuration property display.default.display_options.filters.created.group_info.group_items.1.value.type doesn't exist. in Drupal\Core\Config\Schema\Mapping->get() (line 66 of core/lib/Drupal/Core/Config/Schema/Mapping.php)".
| Comment | File | Size | Author |
|---|---|---|---|
| #205 | 2369119-views-save-error-205.patch | 9.19 KB | darvanen |
| #196 | 2369119-196.patch | 27.23 KB | nemethf |
| #190 | 2369119-190.patch | 27.21 KB | lendude |
| #189 | 2369119-2-189.patch | 27.31 KB | alexpott |
| #187 | 2369119-187-interdiff-proposition.txt | 1.25 KB | tacituseu |
Comments
Comment #2
olli commentedThis contains schema changes from #2357145: Views can not be saved with a numeric (grouped) filter (not in interdiff).
Comment #3
olli commented#2357145: Views can not be saved with a numeric (grouped) filter landed, reroll.
Comment #4
olli commentedComment #5
olli commentedRerolling after #1985406: #states not supported for elements in formatter settings being displayed on Views field handler form.
Comment #6
olli commentedExtended tests to cover single filter.
Comment #8
olli commentedIs it possible to make this dynamic? In #2357145: Views can not be saved with a numeric (grouped) filter we added this:
If not, I think we could alternatively remove views_filter_group_item and move it into views_filter. Maybe it was added due to the confusion early in #2357145: Views can not be saved with a numeric (grouped) filter?
Comment #9
olli commentedHere's the alternative from #8 that removes views_filter_group_item.
Comment #11
olli commentedComment #15
olli commentedComment #17
olli commentedComment #18
olli commentedreroll
Patch #6 (also fixes date filter) still applies.
Comment #19
lendudeThis seems like a duplicate of #2595027: View crash on saving having exposed filter with groupings, different filter, same error. Curious if this fixes that issue too.
Patch didn't apply anymore. Minor reroll.
Comment #21
lendudeSmall update of the issue summary to make this a bit more general.
Manually tested this for both date and permission filter and manually works for both. The test from #2595027: View crash on saving having exposed filter with groupings still fails though. No idea why. Added the test from that issue to this patch and closed that as a duplicate.
Putting on needs review to fire up the testbot, but this will fail.
Comment #22
claudiu.cristeaIt's the same issue as #2595027: View crash on saving having exposed filter with groupings? Closing this as duplicate.
Comment #23
claudiu.cristeaI was wrong.
Comment #25
rakesh.gectcrThe above patch is working fine! +1 to RTBC, Not understanding why the bot getting failed.
I rolled the same patch with latest pull, Let see is that making any difference.
Comment #26
rakesh.gectcrComment #28
halefxPatch in #25 worked for me as well on 8.0.5
Comment #29
dagmarI don't have time to help with this issue, but I did some research and it seems the
plugin_idof the testing views loaded on the tests that are failing have some differences when created by the UI.See:
http://cgit.drupalcode.org/drupal/tree/core/modules/views/tests/modules/...
It says: 'node_type'
But when the filter is created using the UI and saved, the plugin_id for type now says:
bundleI think you should review that part of the code, maybe the views.view.test_exposed_admin_ui.yml needs to be updated. But I'm not sure if this will make the tests pass.
My two cents.
Comment #30
geekygnr commented#25 fixed the issue for me as well in 8.0.5
Comment #31
johnchqueWe should not have failing tests to allow this to be set as RTBC.
Comment #32
asrobIt worked well with drupal core 8.0.5 but it doesn't work with 8.1.0-rc1. That's why I bumped version to 8.2.x-dev.
Comment #33
claudiu.cristeaI disagree. This is a very ugly bug that should be fixed in a patch release of the current minor. So, 8.1.x.
Comment #34
dagmar#2718353: Views group filter on user created won't save set as duplicated of this one.
Comment #35
andypost+1 to fix in 8.1, very annoying bug
Comment #36
andypostComment #37
vprocessor commentedComment #38
vprocessor commentedrerolled
Comment #40
vprocessor commentedComment #42
vprocessor commentedComment #43
lendudeIt was missing a schema for the bundle filter. Added that. This is now passing locally for me.
Comment #45
dagmarTake a look to the status filter for admin/content, this is the default if you install drupal with this patch and click on the exposed status filter.
Same situation applies fro admin/people/list
Comment #46
dagmarI cannot replicate locally the failure reported by automated tests.
I'm adding a new test to check the scenario I posted in the previous screenshot that fails locally.
Comment #47
lendudeWeird, Drupal\system\Tests\Update\UpdatePostUpdateFailingTest fails for me locally too.
Can't really rhyme the plugin_id with the set values. That's where this seems to be going wrong now. But haven't found a fix yet either.
Comment #48
dagmarSorry, I was testing the wrong Testcase. Anyway now we have more test coverage.
Comment #50
lendude@dagmar the extra test is exactly what was needed because it tests the boolean exposed filter. Undid a bit of work that olli did in #8 because the fix there was never going to work like that. The problem with the boolean filter was that 'boolean' is fine for the non-exposed filter, you only need to have 2 settings there, but it wasn't going to work for the exposed filter (it needs yes-no-all). You just can't fit three options into a boolean.
So we need a way to make the exposed filter use a different config then the non-exposed filter. So views.filter.group_item.* is back, with some overrides for filters where the 'value' is a different format for exposed and non-exposed filters.
All previous failing test now pass locally for me, so lets see what happens here.
Comment #51
lendudeAnd for more fun with boolean filters, check out #2459289: Boolean default values are not saved
Comment #53
lendudeTook out a little too much.
Comment #54
olli commentedNice work!
views.filter.group_item.* allows to override *grouped* exposed filter schema if you need it to be different from single exposed filter. Single exposed filter uses same 'value' as non-exposed filter and that is broken with yes-no-all, right?
After fixing the other issue from #51 this views.filter.group_item.boolean might not be needed anymore.
In numeric filter the group item would use views.filter_value.numeric so we can still remove views.filter.group_item.numeric with this?
Do we need that "label: Group items", or should that be the default in "views.filter.group_item.*"?
Comment #55
lendudeThanks for the feedback olli!
54.1 I agree, the override should be on the exposed filter, but as far as I know there is no way to currently override the format for the exposed filter. So adding that here feels like a bit of a scope creep. So I'd say just focus here on getting the grouped filters working with the current fix, then in #2459289: Boolean default values are not saved see what we can do about overriding the format for the exposed filter (or just convert all the boolean filters to strings since that is the only filter that I see that needs a different exposed filter).
I'll post some of our findings there too.
Unless I'm wrong and there is a way to override the exposed filter format, then yeah we should totally use that!
54.2 Absolutely right
54.3 Yeah makes more sense
Comment #56
dawehnerIMHO config schema should simply mirror the class hierarchy. For that, it would be great if this type would be actually its own thing.
Nice test coverage!
Yeah I'm not sure either!
In general for me its not that much of scope creep to be honest, its still kinda related to the issue, but sure, please go with what you prefer.
Comment #57
olli commented#55.1 I agree, the interdiff looks good!
#56.1 I agree. Do you mean change views.filter_value.equality from
type: views.filter_value.stringtotype: stringand thisto
type: views.filter_value.in_operator?Comment #58
lendude@olli oh yeah that looks like a nice addition.
I've rearranged the schema in views.filter.schema.yml a bit because there was a header for '# Schema for the views filter value' but they were actually scattered throughout the entire file which was driving me nuts. So all filter values now fall under that heading. Makes the patch and interdiff a little harder to read, but makes the actual file a lot easier to read, so thought it was worth it.
So the only odd duck in the file is now
That sounds like what the exposed boolean filter should be using, but then it really should be views.filter.boolean_string and it should actually do something other then just inheriting views_filter I think. Maybe something to look at in #2459289: Boolean default values are not saved
But, let's see what this does.
Comment #59
sukanya.ramakrishnan commentedThe latest patch in 58 failed for me when i chose a between operator for a grouped filter on a date field.
Comment #60
lendudeThanks for the feedback @sukanya.ramakrishnan. Not sure why this only revealed itself after adding the catch-all, but datetime needs its own thing.
This fixes the issue, but we need a test where we add a datetime field.
Comment #62
mikeker commentedSetting to NW for the tests. Also bumping to 8.2.x as this patch adds strings.
Comment #64
mikeker commentedFixes the test that was broken in 8.2.x. Doesn't address the need for tests mentioned in #60 so this should go back to NW after the testbot runs.
Comment #65
dagmarComment #66
lendudeAdded test for datetime field, it fails without the change in #60.
Comment #67
jhedstromRemoving the 'needs tests' tag.
Can the test-only patch be uploaded to demonstrate the issue/fix?
Interesting, this same bit of code is being changed over in #2648950: [PP-2] Use form element of type date instead textfield when selecting a date in an exposed filter, although in a slightly different way. I'm going to move that issue back to NR to take a look at this approach.
Comment #68
mpdonadioWith the YAML changes to the schemas, does this require an update path?
Comment #69
lendude@mpdonadio, I don't think so. This patch should make existing Views config not be broken anymore without changes to the current config.
@jhedstrom absolutely, here it goes!
Comment #71
mpdonadioBack to Needs Review per the results of #66.
Comment #72
mpdonadioThis needs an IS update to describe what is really going on and what this patch is fixing. What is a little odd about this situation, is the bug is most evident in the Views UI if you already have content created and then make the view. If you do it the other way around, then you get the error when the view is executed. I don't totally grok this patch to update the IS myself, though (I'm following this because I am working on the patch mentioned in #67).
Few nits with the patch.
Weird format, 'Y-m-d H:i:s' would be more normal.
Two things here. The docblock doesn't describe this test accurately. I think "Test datetime filter UI." would be more accurate. Also, the other tests use the weird underscore convention and get called from testDateFilter(). For consistency sake, this should probably do the same thing.
Comment #73
lendudeThanks for the feedback @mpdonadio. Updated the IS to hopefully beter describe what is going on here.
72.1 yeah that format is strange, changed it.
72.2 updated to follow the _underscore format. You are right, lets stick to that (and since we don't need a fresh drupal install for this test anyway, this way saves on overhead)
Comment #74
lendudeSorry, forgot the interdiff...too much fun at DevDays to keep track of things!
Comment #75
mpdonadioTook one more look at this. I think the IS is mostly OK, but could explain why there are also code changes in addition to the schema changes. Right now, it somewhat appears to have out-of-scope changes if you aren't familiar with the patch. Either way, I don't feel comfortable setting RTBC on this, as I am still scratching my head a bit on a few parts of the schema changes.
Comment #76
lendude@mpdonadio I added little addition to the IS to account for the non-schema changes in the patch, do you think this covers it now?
Comment #77
ronaldtebrake commentedUnfortunately got an error similar to #59 at first:
Steps taken:
- Applied the latest patch on 8.1.3 (worked nicely)
- Ran all the unit tests, no errors there
- Tried to do a new site install with importing the existing views through config yml files.
Exception only occurred when I did a drush si with --locale=XX.
A site install in English gave no issues with the installation, but saving the view through UI after the install gave the Exception you see above as well.
- Tried to save the same existing view with the following settings: Screenshot settings
After that I decided to remove the filter, add it again and export it through the UI to see any difference in the YML files.
Noticed that there was a diff on
plugin_id: datetimeadded to the exported yml file. Which resulted in having no errors anymore :).Not sure if it is because of outdated yml files or anything that the plugin_id wasn't there before.
Comment #78
pminfAfter upgrading to Drupal 8.1.7 and applying the latest patch of this issue, I still get an error when saving one of my views, which includes a geolocation field filter:
I don't know if this a Drupal core issue or an issue of the contrib module geolocation.
This error also occurs on configuration import of the view. This is the filter part:
I'm only able to import the view configuration successfully, if I remove display.default.display_options.filters.field_geo_location_proximity.value from the configuration file.
If I only set display.default.display_options.filters.field_geo_location_proximity.value.max or something different I also get the appropriate error:
Unfortunately I cannot reproduce this error on a fresh installation. Can somebody please give me a clue, where to look for the error cause? I guess it's an configuration schema issue but I'm not familiar with this topic.
Comment #79
lendude@pminf yes this looks like a configuration issue in geolocation. The config that defines the views filter should also define the views filter value.
something along these lines but then geolocation specific.... But that will only start working with this patch applied. So I'd advice to open an issue for geolocation with a link to this issue.
Comment #80
Grayside commentedWorks for me on a Content Type filter.
Comment #81
pminf@Lendude: Thanks for the info. I opened a ticket: Core patch for views grouped filters results geolocation config error
Comment #82
Grayside commentedThe generated query for grouped, exposed content type filters looks like this:
Looks like a zero entry for each type excluded from the group.
Comment #83
lendude@Grayside, you think this is because of the patch or because of an unrelated grouping issue (since this patch is mostly config changes I wouldn't expect this, but who knows)? It looks like the query should work (it doesn't look great, but if it gets the right result set I can live with a follow up issue).
Comment #84
aleevasWorks good for me

Comment #85
andypostshould be fixed in upstream first
we using this patch for a time
Comment #87
mpdonadioLooks like this needs to be re-rolled against 8.2.x
Comment #88
herved commentedIt seems the patch needs reroll because #2686483: Add support for database condition operator "NOT BETWEEN" was committed and changed core/modules/views/src/Tests/Handler/FilterDateTest.php
Comment #89
herved commentedComment #90
andypostback to rtbc
Comment #91
andypostComment #92
mpdonadioComment #94
seanrThis bug exists in 8.1.x as well. Any plans for a backport? This is blocking functionality I need for a client. :-/
Comment #95
mikeker commented@seanr, Once this gets committed to 8.3.x it can be backported assuming there are no string changes that would prevent that. If not, you could still apply the patch manually.
FWIW, the patch applies cleanly to the latest head of 8.3.x; rerunning the tests against 8.3.x.
Comment #98
lendudeUnrelated fails, back to RTBC
Comment #100
daffie commentedThe testbot for 8.3 passes.
Comment #101
jeroen commentedHas anyone tried this with a list of integers or a list of texts?
I am trying to create an exposed filter as a checkbox. So I'm using the trick with grouped filters, allowing multiple selection (to show checkboxes) but only creating 1 group.
When I create a field "field_shower" which is either
a list of text with the values:
shared|Shared
private|Private
or a list of integers with the values:
0|Shared
1|Private
the grouping doesn't work and fails with:
InvalidArgumentException: The configuration property display.default.display_options.filters.field_shower_value.group_info.group_items.1.value.1 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
and
InvalidArgumentException: The configuration property display.default.display_options.filters.field_shower_value.group_info.group_items.1.value.shared doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
respectively.
Comment #102
lendude@Jeroen is this after applying the patch? Because for any filter that isn't a straight up string grouping will fail without this patch.
Comment #103
tlyngej commentedLooks like this patch needs a re-roll after https://www.drupal.org/node/2459289 has been commited
Comment #104
tlyngej commentedI believe that this would cut it for a re-roll
Comment #105
tlyngej commentedGah, forgot to change back to NR.
Comment #106
mpdonadioManually compared the patches, and looks like a good reroll.
Comment #107
dagmarRegarding #101. I tried that on simplytest.me and I couldn't replicate the error.
Comment #108
mpdonadioI asked something similar back in #68, but since there are schema changes, does this need an empty hook_update_N() to force a rebuild so the new schema gets picked up even though it just makes the existing config work (and not require an update path)? TBH, I don't recall these discussions from last year (see #2507899: [policy, no patch] Require hook_update_N() for Drupal 8 core patches beginning June 29 for discussion and jumping off points).
Comment #109
zuernbernhard commentedSo if it works- why do we have to wait until 8.3 ? Would love to see it in the next core release ...
Comment #110
mpdonadioA committer is going to have to make the decision on whether this can go into 8.2.x (I am tentatively setting it back). The policy is at https://www.drupal.org/core/d8-allowed-changes
We are current in RC, so it is not currently eligible w/o a framework manager marking it eligible. After 8.2 is release, it should be able to go in. Bugfixes are allowed, and there isn't anything disruptive in this.
Comment #112
dagmarBack to RTBC.
Comment #113
dawehnerGiven that produces an exception, I think this is actually a major issue.
Comment #114
alexpottThis code is so unmaintainable :(
This change is mixing bug fixes with moving stuff around. Making it super hard to review and work out what is a fix and what is just a move. Makes it super hard to review. Is there anyway to split the fixes and moves up into different patches? Afaik the order in the YAML file should not be significant unless there are duplicates.
Comment #115
alexpottSo the patch attached here makes it much easier to work out what is actually changing in the .schema.yml and we can file a followup to make the ordering more sensible. Fixed a couple of nits too.
Comment #116
alexpottSo this is the only schema removal. This has been debated above (good to see). It'd be nice to confirm this has test coverage.
Comment #118
lendudeWe have some grouped numeric filter tests:
So I think that should do for the bit that got removed?
Rerolled @alexpotts patch so that it's passing again locally. A little too much got removed (which is why I reordered it all in the first place, because it was really hard to keep track of what needed to go where).
Comment #120
lendudeThis override didn't do anything because of the typo in the name and it was just falling back on defaults which were good, without the typo it needs to have a type.
Comment #121
alexpottWell the failing tests of #115 and #118 at least prove we have some test coverage!
Comment #122
lendudeDiscussed with @alexpott on IRC, we could use some more explicit test coverage of buildExposedFiltersGroupForm() changes.
Also we should really have a javascript test for the #states stuff but that could be moved to a follow-up since that would add some major complexity to fixing this.
Comment #123
amy.h commentedWhile we're waiting on getting this fixed is there at least a workaround for this?
Comment #124
lendude@matthew.h applying the patch, thats about all you can do. It should work fine, the only thing missing is additional test coverage.
Comment #125
lendudeSince the changes to
buildExposedFiltersGroupFormare all about showing the right fields with the right values, the easiest way to check this is with a javascript test after all. So a fairly basic test to check if the right fields are shown with the right values.It would be better to also set these values in the test, but phantomJS dies when trying to 'Apply' the exposed filter values (see also #2754985: [backport] Add JavaScript test coverage for adding an exposed filter in Views UI):
Zumba\GastonJS\Exception\BrowserError: There was an error inside the PhantomJS portion of GastonJS.
This is probably a bug, so please report it:
click
html.touchevents.details.js body.user-logged-in.path-admin div.ui-dialog.ui-widget.ui-widget-content.ui-corner-all.ui-front.ui-dialog-buttons.views-ui-dialog-scroll.views-ui-dialog.js-views-ui-dialog div#drupal-modal.ui-front.ui-dialog-content.ui-widget-content div form#views-ui-config-item-form--a8Az0vK1h_o div#edit-options--TXBWT3fLHBE.scroll.js-form-wrapper.form-wrapper
so we have to make due with pre-set values.
Comment #126
lomasr commented1. Reproduced the error : Please see the screen.
2. Applied the patch in #125 , it worked cleanly . Now one group have value type "A set..."
3. When I save the view it still gives me the same error.
Comment #127
lendudeYou need to clear cache after applying the patch or the new config schema won't be used.
Comment #128
mpdonadioIf we need to clear caches after the patch is applied, then we need an empty update hook to do the same thing to ensure it happens when users update core.
Also a minor tweak to avoid a legacy assertion in a new test class.
A quick look at the new test looks good to me.
Comment #129
lendudeYeah I realised the same thing 5 seconds after posting that comment.
Heh, didn't know that was on
AssertLegacyTrait, not all the individual methods are marked as deprecated, so didn't show up in (my version of) PHPStorm.@mpdonadio++
Comment #130
lomasr commentedAfter clear cache it worked . Thanks
Comment #131
attheshow commentedI'm getting the same issue mentioned by @Jeroen (comment #101) after applying the patch and clearing cache. My issue is when using a grouped filter on a List (text) type of field.
Comment #132
lendude*sigh* yup views.filter.list_field is broken too.
Attempt at a fix for that + test. The test fails but the fix works when manually testing this, so probably still something wrong with the test, but not clear headed enough to get it working right now, so here is the progress so far.
Comment #134
lendudeTest and hopefully fix.
Comment #135
danielnolde commentedPatch in #134 fixed the Exception for me (trying to save a view with grouped exposed filter on a timestamp field).
This seems to be a valid solution, hope to see it get into core soon.
Thanks, Lendud!
Comment #136
attheshow commentedPatch #134 is working for me with a grouped filter on a List (text) type of field. Thanks!
Comment #137
andrej galuf commentedUnfortunately, #134 did all sorts of nasties for me, including breaking a custom numeric field extension without min and max values, while still not solving the grouped exposed filter problem (grouped roles filter).
Comment #138
lendude@Andrej Galuf did you have a config schema for that custom field extension? If yes, what did you need to change to get it to work? If no, did adding a config schema resolve your issue?
And I'm sure there are more grouped filters that are not working yet, but we need to get this in to at least have a basis on which to solve those issues.
Anything besides these things? Being specific helps find the issues and solving them...
Comment #139
boinkster commentedPatch #134 doesn't work for me.
I've got an exposed grouped filter on an Entity Ref field. I manually built a select list from Label|nid. It works fine until the remember option is set, then it throws a "An illegal choice has been detected. Please contact the site administrator." when the page is refreshed.
Comment #140
lendude@boinkster that is unrelated to what we are trying to fix here, this is about saving the grouped filter and getting a WSOD. Please search the issue queue for your problem and open a new issue for that if you can't find anything related. Did a really quick search but could only find some D7 issues that appear to be the same problem.
Comment #141
boinkster commentedThanks, I'll open another issue (I found the same D7 post). For my use case, I wasn't getting a WSOD even with unpatched core.
Comment #142
youfei.sun commentedSame issue when using a taxonomy field as grouped exposed filter, #134 won't fix that. Guess all numeric field types has to be fixed or we can have some solution can handle all types of content.
Comment #143
mpdonadioDon't have time for this right now, but per @catch:
And per @catch the post-update hook can be empty in this case to achieve the same thing.
Comment #144
mpdonadioOK, got my computer back.
Comment #145
lendudeThanks for the update @mpdonadio, nice to know what to do in such cases.
This should fix any filters inheriting views.views_filter.in_operator and views.views_filter.many_to_one as the removal of the fix but passing test from #134 should indicate.
This should fix the grouped filter issues indicated in #137 and #142.
Comment #146
youfei.sun commentedI've tested latest patch, it seemed to fix the roles issue in #134, but for taxonomy, the view could save correctly, however the sql query generated is mistaken. Instead of a where clause with corresponding taxonomy term ids, the sql generated became the group ids.
Comment #147
lendude@youfei.sun the generated sql issue sounds unrelated to what we are trying to fix here, so please look around and see if you can find an issue for that and open one if you don't.
Comment #148
youfei.sun commented@Lendude you are right, that belongs to here https://www.drupal.org/node/2049603.
I've got a patch uploaded for d8 to this issue.
Comment #149
chris.smith commentedI've applied the patch in #145 and was able to resolve the issue. I have not completed a thorough review, but from the surface, seems to be OK.
Comment #150
xsdx commentedTested Patch #145 and was able to solve the issue.
Comment #151
sagesolutions commentedApplied patch #145 and was able to fix the related issue Creating a view with exposed filters fails on save
Comment #152
imrancluster commentedI had a custom query's problem. I found the following file which have force fully added "ONLY_FULL_GROUP_BY"
core/lib/Drupal/Core/Database/Driver/mysql/Connection.php
'sql_mode' => "SET sql_mode = 'ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,ONLY_FULL_GROUP_BY'"I removed the "ONLY_FULL_GROUP_BY" from the file then my module run as expected.
Thanks
Comment #153
remram commentedI'm facing the same problem!!! I want to add a group filter to my view. Users should be able to filter by content type.
The preview is working fine but when I try to save my view, it runs to an exception error. I have no idea where the problem is. I'm using Drupal 8.2.2
Comment #154
lendude@remram did you apply the patch in #145 (see Applying patches)? That should resolve your issues.
Comment #155
remram commented@Lendude: I'm not the only one, who is working on this project. I will try it in the near future. Thank you so far :)
Comment #156
smazAnother +1 for patch in #145 fixing my issue: I was unable to save a view that had grouped filters on a taxonomy term field.
Cheers!
Comment #157
tlyngej commentedI don't feel that I'll have the skills to review this, even though I've made a few re-rolls, so can't put it to RTBC.
Any chance that anyone else could, so that this would make it to 8.3?
Comment #158
dawehnerAs talked with @lendude this issue fixes a lot of problems already. There might be more scheme issues in other filters, but creating new issues is easy :)
I documented this in the issue summary as well.
Comment #159
dawehnerThis solves a lot of problems for a lot of people. The SQL errors are unrelated to this issue. Please open up new issues so we can fix them as wel..
Comment #160
oriol_e9gYes, RTBC++
Comment #161
gbyteSuccessfully using the last patch as well.
Comment #163
lendudeUnrelated fails
Comment #165
mpdonadioNot sure who triggered a retest, but the latest fail was b/c #2828559: UpdatePathTestBase tests randomly failing, which is unrelated. In this case, we don't need to re-test. We should let a committer decided what to do.
Comment #166
lendude@mpdonadio I triggered the retest, it failed on the same test twice, just wanted to be absolutely sure it was still passing before starting to spam everybody in the issue with more RTBC->'needs work' flip-flop messages.
But it's green now, so I'm happy!
Comment #167
anavarredeleted - please ignore
Comment #168
anavarreComment #169
blanca.esqueda commentedI was having the same issue ( D8 ), unable to save the view having a exposed grouped filter.
Applied the patch and I was able to save the view.
Unfortunately it didn't work as expected.
I'm using a taxonomy in my grouped filter - to limit the terms to be displayed on the dropdown -.
The dropdown displays the titles correctly but the values selected for the grouped option are not going to the query correctly.
As sample on my grouped filter interface added two options:
Option1 equal to 54 (tid of the term selected)
Option2 equal to 69 (tid of the term selected)
But when I try to filter the view using those options, the results are not the correct ones.
Checked the query itself and the condition for that filter uses the values of the dropdown (incremental pointer) instead of the real values:
Option1 --- taxonomy_target_id = 1 (instead of 54)
Option2 --- taxonomy_target_id = 2 (instead of 69)
Comment #170
blanca.esqueda commentedAlso, something else that I noticed is that it is not passing more than one value.
Added a grouped option selecting two values, and when I checked the query still only passing one value and the wrong one.
Attached three images for clarity:
1.- grouping filter interface
2.- kint displaying the filter elements.
3.- View Query with an option selected on the filter. (from my previous comment).
Comment #171
lendudeThis patch is about that. This is not about solving all problems with all grouped filters in one patch. Updated the title to clarify what we are trying to fix here.
@Blanca.Esqueda please open follow ups for the issues you describe and postpone them on this issue. We need to get this in first before we can start fixing any underlying problems.
Back to RTBC for the fix for the fatal.
Comment #172
claudiu.cristea@Lendude, the test
ExposedFormUITest::testExposedGroupedFilter()has been created as part of duplicate issue #2595027: View crash on saving having exposed filter with groupings. It would be nice if that will be credited too in this ticket.Comment #173
lendude@claudiu.cristea++
Yes @maintainers please also take #2595027: View crash on saving having exposed filter with groupings into consideration when assigning credit.
Comment #174
wturrell commented@Lendude - what's the status with filters grouped by Content Type?
Patch 145 - NB: on a "used", rather than "clean", 8.2.5 install, with a rebuilt cache – doesn't seem to fix it for me; I see #80 saying it's fixed and #153 saying it isn't.
Like #153, works fine in the preview, fails to save changes.
I've a simple grouping on Content: Content Type using the 'is one of' operator for both groups.
The missing config property obviously matches the first checked content type in the first group of the filter.
Anything else I can try to help you?
Comment #175
lendude@wturrell patch works for me.
With a filter set up like this for the Content View:
Without the patch I get the fatal, applied the patch, drush cr, reload page, save View, save successful.
Comment #176
wturrell commentedSorry this was my fault - the patch wasn't being applied, now I've done so, 2369119-145.patch works on the old site and also on a clean 8.2.x install (grouping Content Type by articles and basic pages).
[Rest of this is newbie explanation and can be skipped by more clever people..]
On the failing site I was using 'git apply' on a drupalvm install (with drupal-composer/drupal-project 8.x branch) and I was getting no output other than [ok], and then I realised no files were changing and I wasn't getting any output for
git apply --verbose,git apply --summaryorgit apply --checkeither..I switched from 'git apply' to
patch -p1after reading the only explanation I found, here.Which I take to mean you can only apply patches to https://git.drupal.org/project/drupal.git, otherwise it will silently skip all the commit ID hashes that don't match? (That said, I'd hoped
git apply --checkmight give me some output, seeing as the help text says it's to check if it's applicable...)Also, on your screenshot, what is it you're filtering on to get 'node' and 'other' as the only two options?
(Thanks)
Comment #177
mpdonadioI'm just re-uploading the patch from #145 so we have clean test runs, and we have had a ton of comments since then.
Comment #179
yesct commentedI'm triaging this at the NJ Camp. #2474049: [meta] Major issue triage
Comment #180
yesct commentedI went through the instructions in #2474049: [meta] Major issue triage and it gets all the way to adding the triaged for d8 major current state. (has duplicates marked, summary is up to date, patch applies .. oh, 8.4.x vs 8.3.x, it does apply to 8.4.x... flow chart says to retest, since this is rtbc, it has been being retested on .. hm 8.2.x so I added custom test runs for retesting on 8.3.x and 8.4.x. leaving the version in the meta data for this issue on 8.3.x, partly cause the major issue triage doesn't say to evaluate that field.)
Not needed as part of the major triage meta, but I also checked into if this was major.
And according to https://www.drupal.org/core/issue-priority#major-bug
Cause this is a views issue that deals with database things (and cause someone already decided that the issue should be tested (when it was 8.2.x) on other databases, also adding custom test runs for those on 8.3.x and 8.4.x.
----
Taking a break for now. Next, looks like this could use a code review (especially to make sure that the feedback from alex was addressed).
Comment #181
alexpottI can confirm that my feedback has been addressed. The additional test coverage has been added and changes have been made to keep the schema in line with class inheritance.
And having a javascript test of this form in core gives us more than we've ever had before.
Comment #182
alexpottIt's important we get an answer for @Grayside's question in #82
Comment #183
lendude@alexpott yeah that happens:
Steps to reproduce:
- Apply the patch
- Make two content types
- Make a grouped filter for content type
- Add one group 'is one of' for one content type
- Add one group 'is one of' for the second content type
- Save
- Filter using one of these groups and you wil see IN('node_type_1' ,'0', '0') in the query.
This sounds like work for a follow-up though. This doesn't sound like it is caused by this patch, but it looks like this is an existing bug that just gets exposed by fixing grouped filters in general. I actually expect more issues with grouped filters to float to the surface after this is committed because this will actually allow you to create them....
Comment #184
lendude@alexpott quick check, and yeah this is caused by
\Drupal\views\Plugin\views\filter\InOperator::opSimplenot cleaning the empty checkboxes values:This:
$this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", array_values($this->value), $this->operator);Should be something like:
$this->query->addWhere($this->options['group'], "$this->tableAlias.$this->realField", array_filter(array_values($this->value)), $this->operator);But since 0 is a valid value, it needs more logic then that. (and tests of course)
But like I said, I feel this is unrelated and should not hold up this issue.
Comment #185
alexpott@Lendude well I think we need to filter the disabled checkboxes before we save the view to config rather than when we are constructing the query - can you open a followup for this?
Comment #186
tacituseu commentedThey are added in
Drupal\views\Plugin\views\filter\FilterPluginBase::buildGroupSubmit(), there seems to be a provision for filtering empty values, check:Drupal\views\Plugin\views\filter\FilterPluginBase::hasValidGroupedValue():so it could be as simple as using it in
buildGroupSubmit(), one line fix attached, decide if a separate issue is needed.Comment #187
tacituseu commentedOn second thought... ;)
Comment #188
lendudeFollow up for the InOperator issue: #2857740: Views grouped filters that use InOperator add '0' to the query for every not selected option
@tacituseu please move your proposed fix there, it looks like a great start off point. But it would require tests and it's unrelated to the config change we are doing here, so lets not scope creep it in.
Comment #189
alexpottRebased post array-all-the-things
Comment #190
lendude#189 applies but didn't change the array() notations of the changes in the patch
reroll using https://github.com/thomasbachem/php-short-array-syntax-converter as described in https://www.drupal.org/node/2776975#comment-11969184
Comment #191
alexpottCommitted 594fdb7 and pushed to 8.4.x. Thanks!
I've discussed this issue with @catch, @cilefen and @xjm and we agreed to set this to patch to be ported and consider for inclusion into the 8.3.0 release. Given the addition of an update function and fixes to configuration schema it'd be nice to not have to consider this for 8.3.1 and the number of comments on the issue reflect the fact that a lot of users are running into this issue.
It is really exciting to have javascript testing of the grouped exposed filter functionality. This is incredibly complex and fragile so it is no surprise we broke it.
Comment #193
catchJust to make sure, isn't this the only update function?
If so I'm much less concerned about this going into 8.3.x during the rc than if there was an actual data change. The schema changes make me not want to consider it for 8.3.1 though.
Comment #194
lendude@catch yes the actual data that got saved was always correct, it just didn't match the config schema, hence the fatal.
Comment #195
bkosborneIs there anything that needs to be done to get the patch ready for 8.3, or is it just waiting for a core committer to apply it to 8.3? I'm not sure what the procedure is for the "patch (to be ported)" status.
Comment #196
nemethf commented#189 didn't apply to me because of a recent api doc group removal
Comment #197
alexpottCommitted 6ca8ccc and pushed to 8.3.x. Thanks!
Comment #199
andypostRelated #2865149: We should always use defined group
Comment #201
sukanya.ramakrishnan commentedAnyone having issues saving a view that has taxonomy filters (Not grouped, just regular ones) after applying the patch for 8.2 ?
I am getting this error - The configuration property display.default.display_options.filters..value.4 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
Thanks,
Sukanya
Comment #202
sukanya.ramakrishnan commentedI have been breaking my head over this issue today and i am finding that any view that has a taxonomy filter with the widget as autocomplete or SHS fails with the error.
Dropdown works fine with taxonomy filters. Any inputs appreciated!
Update: I was wrong about dropdown working fine with taxonomy filters. I am still not clear about the usecase, but i am finding this issue with some taxonomy filters , exposed or not exposed and any kind of widget. Looks like some configuration is missing, but just unable to figure it out. !
Update: the filter field for which the view save is failing is a many to one field and the config schema mapping is falling back to views.filter_value.* . I am not too sure what should go for views.filter_value.many_to_one config?
Thanks,
Sukanya
Comment #203
jncrucesI have the date problem with a site recently updated from 8.2.7 to 8.3.1
I do not have filters grouped in the view. If I delete the datetime field I can save as normal.
Comment #204
alex030 commentedSame problem with a site recently updated from 8.2.6 to 8.3.1
I can´t save views with a preselected term but the view is working in frontend.
I temporary fixed the issue by replacing the following files (http://cgit.drupalcode.org/drupal/commit/?id=6ca8ccc) with the files from drupal-8.3.0-rc2
Comment #205
darvanenHere's a patch containing the portions of #196 that didn't make it into 8.x-3.1 which fixed this issue for me recently.
Comment #206
lendudeFor anybody experiencing problems, please open an issue for this so we can address it there. Feel free to post a link to the follow up here so people that worked on this issue might help out with the follow up too.
Comment #207
jncrucesCreating new issue: #2873224
Comment #208
caldenjacobs commentedHere's a new issue for geolocation field module:
#2870523
Comment #209
rgpublicCreating new issue: #2875656
Comment #210
mandavya commentedOn update to 8.3.2, getting the same error when adding filter "Has Taxonomy Term" and choosing a term(dropdown/autocomplete result in same ). It gets executed at view level. Throws unexpected error on save.
InvalidArgumentException: The configuration property display.default.display_options.filters.tid.value.1710 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of /../core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
#204 solution is the closest.
Any help is appreciated.
Srinivas
Comment #211
mandavya commentedImplemented the #204 solution i.e. replacing files with those from 8.3.0-rc2
But, the result is the same. It did not work in my case.
Thanks.
Comment #212
idiaz.ronceroHi, on update to 8.3.2, i'm suddenly getting the same error as #210 and 202ly with Taxonomy Term-related filters
"The configuration property display.default.display_options.filters.field_secciones_target_id.value.52 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php)."
(field_secciones is a term reference field, I also tried generic "has taxonomy term" filters to no avail)
As a result, there is no way views can be saved even if view preview output is OK (major bug!). The other filters work as usual, only seems to affect term-related filters.
Comment #213
ytsurkHaving the same issue with commerce product variation attributes.
A not-so-elegant workaround is using relations ...
Created new issue: #2879869: Fatal error when trying to save a View with a filters using an attribute
Comment #214
gvigroux commentedIf this issue linked to that?
https://www.drupal.org/node/2880081
Comment #215
idiaz.ronceroHi, in my case it was caused by SHS (Simple Hierarchical Select). I don't know why, and it was hard to spot because the error kept happening even if you used core's "autocomplete" or "dropdown" as term filters...
SHS also deleted the views if uninstalled (because of dependencies?) so I had to delete all my term filters, uninstall SHS and re-apply all filters...
Comment #216
ismini papa commentedI'm getting similar issue with webform submissions.
InvalidArgumentException: The configuration property display.default.display_options.filters.webform_submission_value.value.17 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
I tried the listed patches but don't work. I'm on 8.3.4. Any idea or any other patch that could help?
Comment #217
Anonymous (not verified) commentedHi, I was also getting the same error as #212 and it seems to be caused by SHS (Simple Hierarchical Select). After uninstalling that module, the views saved and worked correctly. I'm using 8.3.4 and didn't notice any problems before updating to 8.3. I have opened a bug on SHS https://www.drupal.org/node/2890274. Just putting this here in case others are having similar problems.
Comment #218
timoratd commentedI just upgraded to 8.3.5, saw the same error as #212. it is a very simple view with 'has taxonomy' as filter.
Comment #219
ericshell commentedI can report the same issue as #212 with the same approach as #218.
Comment #220
generalconsensus commentedHaving the same issue with webform_views. Unable to save a select filter
Comment #221
handkerchiefI have the same problem with Drupal Core 8.4.0
The website encountered an unexpected error. Please try again later.InvalidArgumentException: The configuration property display.default.display_options.filters.field_example_target_id.value.60072 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php
Comment #222
handkerchiefhttps://www.drupal.org/node/2873224#comment-12291203
Comment #223
lendude@handkerchief In all cases so far where this occurred after this was fixed in core, this was due to a contrib module not properly declaring a config for a custom Views filter. So look at your filter and see if it uses something from a contrib. If so open up an issue there or otherwise open up a new issue for core and we can look at it there.
see #206
Comment #224
handkerchief@Lendude
Thanks for the reply. Hm... Of course i'm using contrib modules in the project. But for this view, I believe I'm using only core stuff (entity reference etc.). With exception of better exposed filter. ok thanks i will do that.
Comment #225
serg2 commentedPer #206:
Having issues with this over at #2850463: Fix Error whenever saving either of the provided google_analytics_reports view without any customization
Comment #226
bendev commentedHaving this issue with a datetime field used as view filter
issue reported here
https://www.drupal.org/node/2788253#comment-12333847
Comment #227
Cheviot commentedI move my issue to #2879869
InvalidArgumentException: The configuration property display.default.display_options.filters.attribute_product_target_id.value.all doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 .... /ArrayElement.php).
Drupal 8.5.0
Comment #228
turpentyne commentedNot sure if something I'm experiencing might be related to this issue. I'm building a views search using search api and solr. I want to add an exposed view. I choose content datasource, then choose the related taxonomy, then try to set up a grouped filter.
I enter a label, operator is set to 'one of' and I enter the valid taxonomy terms, comma separated. Works just like autocomplete tag-style.
Then I press apply and get error: "A value is required if the label for this item is defined."
In reports I see:
"Warning: trim() expects parameter 1 to be string, array given in Drupal\views\Plugin\views\filter\FilterPluginBase::arrayFilterZero() (line 1559 of /Drupalsite/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php) #0 ..."
Also, when I close and reopen this to edit, the terms have been changed to a string, simply "Array".
Maybe I'm doing something wrong, or maybe it's an issue.
(Drupal 8.5.4 on PHP 7.1.12)