Exposed date filter leads to a notice

Created on 5 October 2016, over 7 years ago
Updated 27 January 2023, over 1 year ago

Problem/Motivation

Adding a exposed filter to a view, and going to that view page leads to a notice, Notice: Undefined index: type in Drupal\views\Plugin\views\filter\Date->acceptExposedInput() (line 125 of core/modules/views/src/Plugin/views/filter/Date.php).

Date::acceptExposedInput is called two times in the views rendering build process (ViewsExecutable::build()) , first time through $exposed_form->renderExposedForm() and second time through $this->build('_filter'). Date::acceptExposedInput is aware that calling its parent will unset the 'type' property it's using, and thus try to restore it.

There's a few early return before the reset though, and when those early return hits, the second acceptExposedInput call won't find the array key it's looking for.

Proposed resolution

Restore the 'type' key before any early return in Drupal\views\Plugin\views\filter\Date::acceptExposedInput().

Steps to reproduce

Starting from a Standard profile installation:

  1. Go to /admin/config/development/logging , and display all messages.
  2. Go to /admin/structure/views/view/content
  3. Add a filter on the "Authored on" field, expose it to site visitors, saves the view
  4. Go to /admin/content

At this point, you'll be greeted with the aforementioned notice. Note that it doesn't show up in the view preview.

πŸ› Bug report
Status

Fixed

Version

8.3 ⚰️

Component
ViewsΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡«πŸ‡·France DeFr

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.

Production build 0.69.0 2024