silverstripe / cwp

Common Web Platform (CWP) features module. We strongly recommend using it for all new CWP projects. Future features will be delivered here.
https://www.cwp.govt.nz
BSD 3-Clause "New" or "Revised" License
10 stars 27 forks source link

Exception thrown in DatedUpdateController when invalid dates are passed in #242

Closed elliot-sawyer closed 4 years ago

elliot-sawyer commented 4 years ago

We've been receiving code-reporting errors on an events page that was receiving invalid dates submitted through this module. While there can be a number of valid reasons why a user might manually type in a date rather than use the datepicker, there's still a problem in that an uncaught exception can occur when one is submitted to the controller.

Screenshot from 2019-12-04 15-13-01

Screenshot from 2019-12-04 15-15-37

Affected: CWP 2.4 Expected: If I submit an "invalid" date in the wrong format, i.e. 19-3-19, I see a friendly error Actual: If I submit an "invalid" date in the wrong format, i.e. 19-3-19, I'll see an InvalidArgumentException in dev mode or a 500 Server Error page in Live mode

Steps to reproduce on a default CWP 2.4 install:

  1. login to the CMS
  2. publish a new Event Holder Page with some Event Pages under it
  3. Visit the page in the front end
  4. Type 19-3-19 in the From date (make sure to type the dashes)
  5. Type 20-3-19 in the To date (make sure to type the dashes)
  6. Click "Filter"
  7. Observe the error
elliot-sawyer commented 4 years ago

A fix has been merged so we can close the issue