Problem/Motivation

Using datetime views filter and filtering with an invalid date, there is no validation and fatal error occured.

To reproduce:

  • Add a datetime field to the 'Basic page' node type (the bundle).
  • Create a view to list the entities and add a filter on the datetime field
  • Create a Page display with its own path to the view
  • View the page display
  • In the exposed filter enter a search string in an invalid format e.g. try: lun 2018-04-27. The following error should occur:
    <em class="placeholder">Exception</em>: DateTime object not set. in <em class="placeholder">Drupal\Component\Datetime\DateTimePlus-&gt;__call()</em> (line <em class="placeholder">355</em> of <em class="placeholder">core/lib/Drupal/Component/Datetime/DateTimePlus.php</em>). <pre class="backtrace">Drupal\datetime\Plugin\views\filter\Date-&gt;opSimple(&#039;sesame_quota_option__field_sesame_opt_date.field_sesame_opt_date_value&#039;) (Line: 314)
    Drupal\views\Plugin\views\filter\NumericFilter-&gt;query() (Line: 1370)
    Drupal\views\ViewExecutable-&gt;_build(&#039;filter&#039;) (Line: 1259)
    Drupal\views\ViewExecutable-&gt;build() (Line: 390)
    Drupal\views\Plugin\views\display\PathPluginBase-&gt;execute() (Line: 180)
    Drupal\views\Plugin\views\display\Page-&gt;execute() (Line: 1627)
    Drupal\views\ViewExecutable-&gt;executeDisplay(&#039;page_1&#039;, Array) (Line: 77)
    Drupal\views\Element\View::preRenderViewElement(Array)
    call_user_func(Array, Array) (Line: 378)
    Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
    Drupal\Core\Render\Renderer-&gt;render(Array, ) (Line: 226)
    Drupal\Core\Render\MainContent\HtmlRenderer-&gt;Drupal\Core\Render\MainContent\{closure}() (Line: 582)
    Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 227)
    Drupal\Core\Render\MainContent\HtmlRenderer-&gt;prepare(Array, Object, Object) (Line: 117)
    Drupal\Core\Render\MainContent\HtmlRenderer-&gt;renderResponse(Array, Object, Object) (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber-&gt;onViewRenderArray(Object, &#039;kernel.view&#039;, Object) (Line: 76)
    Drupal\webprofiler\EventDispatcher\TraceableEventDispatcher-&gt;dispatch(&#039;kernel.view&#039;, Object) (Line: 156)
    Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
    Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
    Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
    Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 99)
    Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 78)
    Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 38)
    Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware-&gt;handle(Object, 1, 1) (Line: 50)
    Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 664)
    Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
  • Search for the same date with day in english works: mon 2018-04-27. Same for date only: 2018-04-27

Proposed resolution

Mimic the date filter validation from views module.

Remaining tasks

  1. Add tests
  2. Review

Issue fork drupal-2966735

Command icon 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

GoZ created an issue. See original summary.

goz’s picture

Issue summary: View changes
goz’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new2.08 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2966735-3-validate-datetime-views-filter.patch, failed testing. View results

goz’s picture

Status: Needs work » Needs review
StatusFileSize
new2.41 KB
new620 bytes

Fix missing use declaration

goz’s picture

Add some tests to not check grouped filter and empty value.

manicato’s picture

Status: Needs review » Needs work

After applying the patch the date filter only accepts MM/DD/YYYY date format. My default date format is DD/MM/YYYY. When I select 13/05/2018 I get a "Wrong date format" error.

mpdonadio’s picture

Seems like proper fix. Not sure about the format thing. Hmmm.

mpdonadio’s picture

I wonder if we can really do anything about the format until #2648950: [PP-2] Use form element of type date instead textfield when selecting a date in an exposed filter lands. Date::opSimple() and ::opBetween() basically do the same thing. Since a format isn't chosen, you are at the whim of what DTP will do (the Rethans book probably has the best explanation).

+++ b/core/modules/datetime/src/Plugin/views/filter/Date.php
@@ -98,6 +99,50 @@ public static function create(ContainerInterface $container, array $configuratio
+      $convert = new DateTimePlus($value);

Wondering out loud if we want to add the timezone here (and below) to mirror what the filter does?

dhirendragrazitti’s picture

I am also facing the issue in on of the website. How to resolve this.

The website encountered an unexpected error. Please try again later.Exception: DateTime object not set. in Drupal\Component\Datetime\DateTimePlus->__call() (line 355 of core/lib/Drupal/Component/Datetime/DateTimePlus.php)

Any help would be appreciated. when I upgraded the site from drupal 8.3.9 to drupal 8.5.3.

pixelpreview@gmail.com’s picture

Same problem with date between in my french website

stsier’s picture

The patch #6 is almost good. It lacks this workaround into validateExposed()

    $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
    if($language == "fr")
    {
         $dt = date_create_from_format('d/m/Y', $value);
         if($dt!==FALSE)
            $value = $dt->format("m/d/Y");
    }

$dt might be false when using relative dates like "+1 month "

pixelpreview@gmail.com’s picture

yes something like this :

    $language = \Drupal::languageManager()->getCurrentLanguage()->getId();
    $languages = ['fr', 'nl', 'de', 'en']; // I think the best place for retrieve this values is to create a method in languageManager object
    if ($operators[$operator]['values'] === 1) {
      if(in_array($language, $languages)) {
        $date_style = date_create_from_format('d/m/Y', $value);
        if($date_style !== FALSE) {
          $value = $date_style->format('m/d/Y');
        }
      }
      $convert = new DateTimePlus($value);
      if ($convert->hasErrors()) {
        $form_state->setError($form[$this->options['expose']['identifier']], $this->t('Invalid date format.'));
      }
    }
    elseif ($operators[$operator]['values'] === 2) {
      if(in_array($language, $languages)) {
        foreach ($value as $key => $date_value) {
          $date_style = date_create_from_format('d/m/Y', $date_value);
          if($date_style !== FALSE) {
            $value[$key] = $date_style->format('m/d/Y');
          }
        }
      }
      $min = new DateTimePlus($value['min']);

a code like this works in local with exposed dates filter
the difficulty is to extend to a global solution for all Europeans languages like fr, nl, de for example and formats for other countries like YMD
https://en.wikipedia.org/wiki/Date_format_by_country

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Sudheesh S. Babu’s picture

StatusFileSize
new3.39 KB

I have a view which can be filtered by using a date exposed filter. The filtering didn't work properly. The patch https://www.drupal.org/project/drupal/issues/2966735#comment-12590809 works for me. But I had to alter it a little bit to remove the timezone data from the dates, which was causing the bug in my case.

My altered custom patch is attached to this comment. I think it's not the proper way of adding extra functions to the core file.

madmax69’s picture

hello

i have the same problem

Exception: DateTime object not set. in Drupal\Component\Datetime\DateTimePlus

I have test the patch 6 and i have a blank page

any news please ?

i have error : Avalid date format,

i have put the last patch and i have theses errors :

core/modules/datetime/src/Plugin/views/filter/Date.php).
Drupal\datetime\Plugin\views\filter\Date->validateExposed(Array, Object) (Line: 140)
Drupal\views\Form\ViewsExposedForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'views_exposed_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('views_exposed_form', Array, Object) (Line: 576)
Drupal\Core\Form\FormBuilder->processForm('views_exposed_form', Array, Object) (Line: 319)
Drupal\Core\Form\FormBuilder->buildForm('views_exposed_form', Object) (Line: 135)
Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase->renderExposedForm() (Line: 1238)
Drupal\views\ViewExecutable->build(NULL) (Line: 1391)
Drupal\views\ViewExecutable->execute(NULL) (Line: 1454)
Drupal\views\ViewExecutable->render() (Line: 131)
Drupal\views\Plugin\views\display\Block->execute() (Line: 1630)
Drupal\views\ViewExecutable->executeDisplay('listing', Array) (Line: 77)
Drupal\views\Element\View::preRenderViewElement(Array) (Line: 59)
Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 163)
Drupal\block\BlockViewBuilder::preRender(Array)

thank you very much

pq’s picture

Version: 8.6.x-dev » 8.7.x-dev
Status: Needs work » Needs review
StatusFileSize
new3.27 KB

Patch from #15 rerolled for D8.7.x

mpdonadio’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/datetime/src/Plugin/views/filter/Date.php
    @@ -11,6 +11,7 @@
    +use Drupal\Core\Form\FormStateInterface;
    

    Nity, should be alphabetical.

  2. +++ b/core/modules/datetime/src/Plugin/views/filter/Date.php
    @@ -179,4 +180,77 @@ protected function getOffset($time, $timezone) {
    +  public function removeTimezoneFromDate($date_data) {
    

    Prob should be protected. Also needs $date_data and return documented in the docblock.

Need to look at this closer but we need a test to demonstrate the problem in the IS, and then show that this fixes it. So, back to Needs Work.

omnia.ibrahim’s picture

I applied patch #17 and got the error:
( ! ) Fatal error: Cannot use Drupal\Core\Form\FormStateInterface as FormStateInterface because the name is already in use in /var/www/html/docroot/core/modules/datetime/src/Plugin/views/filter/Date.php on line 15

handkerchief’s picture

#17 works for me.
Drupal 8.7.5

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.9 was released on November 6 and is the final full bugfix release for the Drupal 8.7.x series. Drupal 8.7.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.8.0 on December 4, 2019. (Drupal 8.8.0-beta1 is available for testing.)

Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

jurgenhaas’s picture

The patch from #17 is working despite the fact that it introduces a couple of new minor issues. At least the major problem is gone.

ravi.shankar’s picture

StatusFileSize
new3.33 KB
new1.68 KB

Here I have added a new patch after making changes as suggested in comment #18.

I have also removed the commented code from patch #17.

But it still needs tests.

hdotnet’s picture

I'm experiencing this issue too, often triggered by crawlers.

category=22&field_publication_date_value[max]=nowfield_publication_date_value[min]=1990-01-01&items_per_page=50&language=***LANGUAGE_language_interface***&market=All&page=4&vt=4

Looking at the query I think my issue is more around a missing & in the GET string.

Not sure that the error deserves a WSOD of death though.

#17 works for me, Drupal 8.8.5

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

psf_’s picture

#23 don't works for me, I have problems with date formats. It only allows English format.

And if I set "greater than or equal to" filter I get:

Warning: Illegal string offset 'min' in Drupal\datetime\Plugin\views\filter\Date->validateExposed() (line 218 of core/modules/datetime/src/Plugin/views/filter/Date.php).
Warning: Illegal string offset 'max' in Drupal\datetime\Plugin\views\filter\Date->validateExposed() (line 218 of core/modules/datetime/src/Plugin/views/filter/Date.php).
Warning: Illegal string offset 'min' in Drupal\datetime\Plugin\views\filter\Date->validateExposed() (line 219 of core/modules/datetime/src/Plugin/views/filter/Date.php).
Warning: Illegal string offset 'min' in Drupal\datetime\Plugin\views\filter\Date->validateExposed() (line 219 of core/modules/datetime/src/Plugin/views/filter/Date.php).
Warning: Illegal string offset 'max' in Drupal\datetime\Plugin\views\filter\Date->validateExposed() (line 220 of core/modules/datetime/src/Plugin/views/filter/Date.php).
Warning: Illegal string offset 'max' in Drupal\datetime\Plugin\views\filter\Date->validateExposed() (line 220 of core/modules/datetime/src/Plugin/views/filter/Date.php).
Formato de fecha no válido.

danielveza’s picture

I'm running into this too, on a multilingual site. Investigating now.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
andrei.vesterli’s picture

Hello there

I've just done a re-make for the patch for core 9.3.9. Hopefully, this will work ok.

Regards,
Andrei

andrei.vesterli’s picture

Status: Needs work » Needs review

Who can review the latest patch and say something in terms of coverage?

odai atieh’s picture

StatusFileSize
new3.36 KB

I rerolled #23 patch and added some changes.

Status: Needs review » Needs work

The last submitted patch, 33: 2966735-33.patch, failed testing. View results

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

cilefen’s picture

@Odai Atieh Would you please post an interdiff illustrating those changes, and perhaps describe what they are?

cilefen’s picture

Status: Needs work » Needs review
StatusFileSize
new1.71 KB

This is a reroll of #30 for 9.4.x.

#33 may be interesting, but it isn't explained and it failed tests. I'd like to hear more about it.

piggito made their first commit to this issue’s fork.

piggito’s picture

I noticed the last patch was only working for the case when we expose the operator so I updated MR https://git.drupalcode.org/project/drupal/-/merge_requests/2151 to also consider the cases when operator is not exposed and when using operator IS BETWEEN

Manibharathi E R’s picture

After Updating the Patch #37 is failing. Issue still not fixed in Drupal 9.4.x.

Steps to reproduce:
1. Create a date field in the Entity bundle.
2. Create a view with Date exposed filter.
3. Search any keyword and Date format will get the Error message in the Recents.

gaele’s picture

StatusFileSize
new4.84 KB

Latest MR as patch attached.

jaime@gingerrobot.com’s picture

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.03 KB

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

arunkumark’s picture

Status: Needs work » Needs review
StatusFileSize
new2.14 KB

I also faced the same issue with the Date time object on the Views exposed filter having the wrong Date format. The issue is due to the Views Token filter module. After the proper token update it works fine.

But, expected to show a valid error or warning rather than a page break. The patch was not applied with the latest version of Drupal core 10.1.x. Rerolled the patch and resolved the page break.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.2 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

akram khan’s picture

StatusFileSize
new2.08 KB
new1.22 KB

added updated patch fixed CCF #45. modifies the validateExposed() function to use a local variable $form_element to hold the field element that needs to be set with the form error message. It also changes the if-else block to use the null coalesce operator instead of an if-else block for brevity.

akram khan’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Also look at the tags please. Was previously tagged for test which are still needed.

edwardsay’s picture

StatusFileSize
new2.14 KB

Patch works, but not in case the form element in the exposed form is placed inside a container or other wrapper. I added support for this case. Also, I faced an issue with the "reset" button while testing this patch: validation didn't let me perform the reset action. So I added improvement for that case as well.

edwardsay’s picture

StatusFileSize
new2.14 KB

Code style improvement.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

douggreen made their first commit to this issue’s fork.

douggreen’s picture

I still get a PHP warning in AttributeArray (line 79) because the original input array is statically cached in ViewExecutable::getExposedInput() on line 726, which happens before the data is validated. We need to validate the data before it is saved. - This may be a project specific error, please ignore for now.

greg boggs’s picture

Status: Needs work » Needs review

Saw this exception in my log slowing down my website because bots trigger this one a lot. Looks like there's been significant work done on this merge request since it's last review.

smustgrave’s picture

Status: Needs review » Needs work

Seems will still need test coverage for this. MR should be updated for 11.x

oily’s picture

Issue summary: View changes
oily’s picture

Issue summary: View changes
oily’s picture

StatusFileSize
new222.62 KB

I have reproduced the error in the UI of Drupal 11.x-dev. See screenshot of the test view

oily’s picture

aurora.luzzardi’s picture

The current solution seems not to solve the issue if a URL accessing the date field has an invalid date format.
For example, we received this request:

?to_date[date]=../admin/noop.cgi?foo=bar&test=blah

A bot trying to brute force and causing issues, in that case, it throws the same error:

User error: Exception thrown while calling __toString on a Drupal\Core\Datetime\DrupalDateTime object in /var/www/html/docroot/core/lib/Drupal/Component/Datetime/DateTimePlus.php on line 354: DateTime object not set. in Drupal\Component\Datetime\DateTimePlus->__toString() (line 20 of core/lib/Drupal/Component/Utility/ToStringTrait.php).
Drupal\Component\Datetime\DateTimePlus->__toString() (Line: 161)
Drupal\views\Plugin\views\filter\Date->acceptExposedInput(Array) (Line: 184)
Drupal\views\Form\ViewsExposedForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 609)
Drupal\Core\Form\FormBuilder->processForm('views_exposed_form', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm('\Drupal\views\Form\ViewsExposedForm', Object) (Line: 134)
Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase->renderExposedForm() (Line: 1304)
Drupal\views\ViewExecutable->build(NULL) (Line: 1457)
Drupal\views\ViewExecutable->execute(NULL) (Line: 1520)
Drupal\views\ViewExecutable->render() (Line: 133)
Drupal\views\Plugin\views\display\Block->execute() (Line: 1696)
Drupal\views\ViewExecutable->executeDisplay('block_3', Array) (Line: 81)
Drupal\views\Element\View::preRenderViewElement(Array) (Line: 61)
Drupal\views\Plugin\Block\ViewsBlock->build() (Line: 106)
Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender(Object, 'section_component.build.render_array', Object)
call_user_func(Array, Object, 'section_component.build.render_array', Object) (Line: 97)
Drupal\tracer\EventDispatcher\TraceableEventDispatcher->dispatch(Object, 'section_component.build.render_array') (Line: 90)
Drupal\layout_builder\SectionComponent->toRenderArray(Array, ) (Line: 88)
Drupal\layout_builder\Section->toRenderArray(Array) (Line: 331)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildSections(Object) (Line: 291)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple(Array) (Line: 340)
Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 282)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 239)
Drupal\Core\Entity\EntityViewBuilder->build(Array)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 97)
Drupal\tracer\EventDispatcher\TraceableEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 263)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 130)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\tracer\StackMiddleware\TracesMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I will check to apply a fix for that case too.

oily changed the visibility of the branch 2966735-datetime-date-views to hidden.

oily’s picture

StatusFileSize
new148.7 KB
  1. A new branch based on 11.x-dev has been created and is now the default branch
  2. The new datetime field validation patch has been committed to a MR
  3. The validation function code has been fixed including phpstan
  4. The pipeline is running green
  5. Testing locally in a test view with an exposed datetime filter, the fix validates wrongly formatted dates

The new validation function validating a view datetime field

oily’s picture

Test coverage is now in place. Changing status to 'Needs review'.

oily’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.56 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

oily’s picture

Status: Needs work » Needs review

Applied bot fix

oily’s picture

Issue tags: -Needs tests
oily’s picture

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Why remove Needs Review Queue Initiative tag?

oily’s picture

Good spot. Have restored the attribute.

oily’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe feedback has been addressed here.

quietone’s picture

I read the comments and the MR and tested the change locally. I find that all questions are answered. I also updated credit.

And, I'd like to remind committers that screenshots should be available from the issue summary.

Leaving at RTBC

  • catch committed a7351cb1 on 10.5.x
    Issue #2966735 by oily, goz, andrei.vesterli, ravi.shankar, edwardsay,...

  • catch committed bb9e16cf on 11.x
    Issue #2966735 by oily, goz, andrei.vesterli, ravi.shankar, edwardsay,...
catch’s picture

Version: 11.x-dev » 10.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 10.5.x, thanks!

greg boggs’s picture

oh heck yeah. Can't wait to upgrade. This is my only logged error.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bserem’s picture

@greg FYI the patch from gitlab applies nicely to 10.4.8

lifesxff’s picture

Tested the patch on Drupal 11.1.6, and it doesn’t apply.