Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#2 | format_date_exception.patch | 5.13 KB | neclimdul |
#2 | format_date_exception--test-only.patch | 4.25 KB | neclimdul |
Comments
Comment #2
neclimdulI did some cursory tests locally and this seems to work. Lets see what the test suite says.
Comment #3
mkalkbrennerThanks for the patch!
The drupal.org testbot is not able to perform our tests. Our README.md states:
I did that for you and the tests succeeded: https://travis-ci.org/mkalkbrenner/search_api_solr/builds/617851835
Comment #5
mkalkbrennerComment #6
mkalkbrenner