Problem/Motivation
There is no schema entry for views.filter_value.comment_ces_last_updated, which triggers a fatal error when used in a view.
#2925890: Invalid config structures can result in exceptions when saving a config entity has a patch that addresses Drupal's reaction to the missing schema. This ticket is for providing the missing schema entry.
Steps to reproduce
Using a fresh install of Drupal 9.5:
Create an article node
Create a view that lists content
Put a filter on the view for "Last updated/commented" and set it to a relative time like "-10 minutes"
Save the view
Proposed resolution
Add the missing schema entry.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | filter_value_schema-2873224-33.patch | 660 bytes | kasey_mk |
Comments
Comment #2
jncrucesComment #3
jncrucesI get it working temporary appling the attached patch as reversed.
patch -p1 -R < 2873224-3-APPLY-REVERSED-PATCH.patchThe patch goes back the files to drupal-8.3.0-rc2 (http://cgit.drupalcode.org/drupal/commit/?id=6ca8ccc). Based on https://www.drupal.org/node/2369119#comment-12056954
Comment #4
mpdonadioWe need a functional test to demonstrate this problem.
Comment #5
andypostComment #6
lendudeSteps I tried to reproduce:
Adding config file of the View I used
Comment #7
jncrucesI don't understand what is happening. After the update from 8.2.7 to 8.3.1 I have the problem. I removed the core folder and downloaded it through composer install. Always with the same error saving the views (I have a lot of views with date exposed fields with between operator configured).
Now I repeated the process. I removed the core folder, download it through composer install... now the problem was gone away... it's impossible, nothing has changed.
Maybe the configurations was updated and now are different. I will retry the upgrading, I have a database saved before upgrading.
Comment #8
jncrucesYes... the problem persist.
I'm trying to reproduce in a clean environment.
1. Fresh installation.
2. On Article content type i added a Date field that store only dates.
3. Created a view and added some configuration to seem it with the problematic view.
4. Saving without problems.
But some is different. In my new installation the date field have not granularity.
Attached two images.
screen_20170428-142927.png -> Old view with problems.
screen_20170428-142957.png -> New view without problems.
Comment #9
jncrucesI'm sorry.
I have a custom module that is aggregating the granularity option to date and i think that some is wrong with the update of Drupal.
The site with the problem, a lot of people worked on it since more than a year ago. A lot of functionality is created for it. I have to study how to change these configuration.
I think that i can close this issue.
Greetings.
Comment #10
jncrucesComment #11
lendude@jncruces thanks for reporting back your findings.
Comment #12
handkerchiefI have the same problem with Drupal Core 8.4.0
I don't think I have the same closed-issue-reason like @jncruces.
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
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_example_target_id.value.60072', '60072') (Line: 211) Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_example_target_id.value', Array) (Line: 211) Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_example_target_id', Array) (Line: 211) Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters', Array) (Line: 211) Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options', Array) (Line: 211) Drupal\Core\Config\StorableConfigBase->castValue('display.default', Array) (Line: 211) Drupal\Core\Config\StorableConfigBase->castValue('display', Array) (Line: 212) Drupal\Core\Config\Config->save() (Line: 280) Drupal\Core\Config\Entity\ConfigEntityStorage->doSave('timeline', Object) (Line: 392) Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 259) Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 377) Drupal\Core\Entity\Entity->save() (Line: 637) Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 989) Drupal\views_ui\ViewUI->save() (Line: 324) Drupal\views_ui\ViewEditForm->save(Array, Object) call_user_func_array(Array, Array) (Line: 111) Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51) Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585) Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object) (Line: 314) Drupal\Core\Form\FormBuilder->buildForm('view_edit_form', Object) (Line: 48) Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 226) Drupal\views_ui\Controller\ViewsUIController->edit(Object, 'block_1') call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 576) 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}() call_user_func_array(Object, Array) (Line: 153) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50) Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 60) Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Comment #13
lendude@handkerchief does this happen on a clean D8 install too? Can you provide a yml file of the View in question? Or give some steps to reproduce this on a clean D8 install?
Comment #14
handkerchiefSo I found the "problem"... and yes, it's an individual problem.
I'm using this "trick" for selecting nodes in my exposed filter like taxonomies.
https://drupal.stackexchange.com/a/231771
The plugin is almost a duplicate from the taxonomy filter: https://gist.github.com/StryKaizer/ae1cb9abc4844a9e7ac12317a9d84a78
With this plugin (which should be also included in core - I mean the functionallity) the error appears. So I suppose the taxonomy filter had this problem too. If l knew what was changed there, I can adapt this for the plugin.
Any advice?
Comment #15
lendudeSo you need to have a config schema for all Views filter plugins, otherwise Drupal has no idea how to save your data to config (it defaults to a string value, but that is not what you are using, hence the fail).
See core/modules/views/config/schema/views.filter.schema.yml and core/modules/taxonomy/config/schema/taxonomy.views.schema.yml for some examples.
something like this would do unless you store more data then the base taxonomy filter:
Comment #16
handkerchief@Lendude Thank you for the awesome and quick support. I wish other maintainers would react so quickly. Have a nice day.
Comment #17
golddragon007 commentedI had this error:
InvalidArgumentException: The configuration property display.page_2.display_options.filters.title.value.value doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of D:\phptest\theideaproject\web\core\lib\Drupal\Core\Config\Schema\ArrayElement.php).
When I tried to save my views.
I have two node types. 1 has reference to the other one. I created an exposed filter with count aggregation, which works fine in preview. But when I tried to save, I get fatal error.
Comment #18
SakaSerbia commentedI get the some problem when update from drupal 8.3.7 to 8.4.2.
views module
Update revision_metadata_fields
Failed: InvalidArgumentException: The configuration property display.default.display_options.filters.field_tip_target_id.value.14 doesn't exist.
in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 у /site/core/lib/Drupal/Core/Config/Schema/ArrayElement.php).
View are no more update, they show the some content as in past. If I add now node its is not posible to see in view.
Comment #19
SakaSerbia commentedComment #20
ohthehugemanatee commentedI'm experiencing this, too, with any View that uses the core taxonomy_index_tid filter . Happens during an update from 8.3.x -> 8.4.x
The schema is properly defined for this filter. It should be a sequence.
Here's what core exports for one of my Views, using this filter:
Looks fine to me.
But Sequence::get() (actually ArrayElement::get() ) does the following:
That method receives "display.default.display_options.filters.field_term_section.value.26" as an argument.
When we get down to the term ID value, we get a StringData, which is not an instance of TypedConfigInterface... and that's where we get InvalidArgumentException.
I'm not sure where the actual bug is:
- Is Views exporting this one wrong? (not that I can tell)
- Is this related to the update? Doesn't look that any related code was changed...
- Should StringData be valid as well as TypedConfigInterface?
- Should StorableConfigBase::castValue() check the schema to see if it's a sequence, and simplify the value somehow?
I discovered this error during an update, when it tried to run views_post_update_revision_metadata_fields(). That function just runs save() on all your extant Views. I do not see an error when I save the View in the UI, however.
TO REPRODUCE:
* fresh install of Drupal 8.3.x, "standard" profile
* create a term in the "tags" vocabulary
* create a View of nodes, with a taxonomy_term_id filter for this term ("Content: tags: test term")
* save the View.
* update to Drupal 8.4.x
Comment #21
ohthehugemanatee commentedFurther debugging got me to the root of this: search_api_taxonomy module overrides the definition for the taxonomy_index_tid incorrectly. This is fixed in #2917399: Missing / broken handler when adding a filter for a field , which is included in search_api-8.x-1.6 .
Closing this ticket.
Comment #22
fernly commentedThe issue still persists in drupal 8.6.0-beta2.
The fatal error appears when a default value is given to a views filter and the view gets saved. The filter in my case is custom and extends the in_operator filter. It basically only adds other option values instead of the default Yes/No.
Comment #23
lendude@lennartvv see #15, did you add a config schema for your custom filter?
Comment #24
fernly commentedI was looking at that right after my post :-).
That solved the issue indeed. Though it was really trial and error as documentation is so low on this matter. Thanks for the quick response!
#15 contains the solution: all views filter plugins need config schema.
Comment #25
kasey_mk commentedI had a problem with a view using the "Embed" display and the comment_ces_last_updated filter from Comment Statistics. Every time I tried to save my view:
Patch #18 from https://www.drupal.org/project/drupal/issues/2925890 seemed to help.
Comment #26
lendude@Kasey_MK that patch doesn't really fix the issue, it just changes it from an exception to a watchdog error. The underlying problem is most likely that Comment Statistics should have a config schema for the filter (didn't check).
Comment #27
kasey_mk commentedI did find the config schema for the filter in comment.views.schema.yml:
Which is what's used in my view as the plugin_id:
Comment #28
hongqing commentedI got the same error "InvalidArgumentException: The configuration property display.page_search.display_options.filters.title.value.min doesn't exist." with 8.9.16.
I used one indexed filed to create an exposed filter, the indexed field is "fulltext", when I change it to "string", this error disappears.
I reinstall Views Autocomplete Filters module and it works again. Therefore, I am not sure if it is the problem of this module or the core.
Comment #29
hongqing commentedComment #30
hongqing commentedComment #31
solrsearching commented#28 is a solution but if you want to search using 'contains' in your view filter then you need 'fulltext' and then you get the error (I managed to make it work on one field, but I don't know how anymore .. :-/ )
Comment #32
kasey_mk commentedThese two steps seem to have stabilized my site and I'm no longer seeing errors on saving my view nor on config-imports:
comment_ces_last_updatedtonumericComment #33
kasey_mk commentedI think I have finally figured this one out (at least for the schema that was missing in my use case) - we need a schema for
views.filter_value.comment_ces_last_updatedin
core/modules/comment/config/schema/comment.views.schema.ymlas follows:views.filter_value.dateis of typeviews.filter_value.numericwhich is defined incore/modules/views/config/schema/views.filter.schema.ymland which contains the missing min, max, and value schemas. Patch attached.This problem definitely still exists in Drupal 9.5.x on a fresh install. Create some content and then try to create a view with a "Updated/commented date" filter set to something like "Is greater than or equal to" an offset value of something like "-10 minutes." The view can't be saved and yields the fatal error in this issue.
For other missing schemas, perhaps the issue is similar?
Comment #34
kasey_mk commentedComment #35
darvanenI have reproduced this problem per the steps to reproduce provided in #33.
As correctly noted in #32 there is already a ticket for handling the exception, so I'm setting the purpose of this ticket to be the provision of the missing schema entry.
I did try the patch in #33 and it worked well, thank you. Having made such a big change to the IS however, I don't think I can push this to RTBC.
Comment #36
mstrelan commentedHad a look and agree that #33 is an appropriate fix for this. I had a look if there were any other filters with
type: views.filter.datein comment.views.schema.yml but this is the only one.Moving this to comment.module rather than views.module since that's where the integration exists. Also moving to 10.1.x because I guess we need to fix it there first before a backport.
Finally, I think we should add some test coverage around this. There are some tests in the
Drupal\Tests\comment\Kernel\Viewsnamespace that might be worth looking at, for exampleCommentUserNameTestsounds like it might be testing similar functionality, or perhaps\Drupal\Tests\comment\Functional\Views\CommentFieldFilterTest.Comment #37
darvanenI wonder if the test in #2086125: Last read comment field/filter/argument uses still the node.changed instead of node_field_data.changed column would do the trick.