Problem/Motivation

When passed an incorrectly formatted date, formatDate allows \DateTime to throw an exception instead of failing gracefully. This can happen when you have a date exposed to user input in some way, for example in a facet.

Proposed resolution

The docblock suggests we can return false on failure so catch the exception and do that.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neclimdul created an issue. See original summary.

neclimdul’s picture

Status: Active » Needs review
FileSize
4.25 KB
5.13 KB

I did some cursory tests locally and this seems to work. Lets see what the test suite says.

mkalkbrenner’s picture

Status: Needs review » Fixed

Thanks for the patch!

The drupal.org testbot is not able to perform our tests. Our README.md states:

Patches and Issues Workflow
---------------------------

Our test suite includes integration tests that require a real Solr server. This
requirement can't be provided by the drupal.org test infrastructure.
Therefore we leverage travis for our tests and had to establish a more complex
workflow:
  1. open an issue on drupal.org as usual
  2. upload the patch for being reviewed to that issue on drupal.org as usual
  3. fork https://github.com/mkalkbrenner/search_api_solr
  4. apply your patch and file a PR on github
  5. add a link to the github PR to the drupal.org issue

The PR on github will automatically be tested by travis and the test results will
be reflected in the PR conversation.

I did that for you and the tests succeeded: https://travis-ci.org/mkalkbrenner/search_api_solr/builds/617851835

mkalkbrenner’s picture

Status: Fixed » Active
mkalkbrenner’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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