HomePhorge

Validate some user provided calendar query range dates

Description

Validate some user provided calendar query range dates

Summary:
Calendar search form allows users to define date ranges. Entering gibberish data leads to a cryptic exception due to calling format() on null, as AphrontFormDateControlValue::getDateTime() can return null instead of a DateTime object.

Also add some additional PhpDoc as a result of playing with this code.

Note that other calendar query forms are more lenient and still accepts gibberish after applying this patch. The intention behind this patch is replacing a cryptic exception with a more appropriate and descriptive error; this patch does not attempt to introduce validation everywhere.

EXCEPTION: (Error) Call to a member function format() on null at [<phorge>/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php:469]

Closes T15943

Test Plan:

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15943

Differential Revision: https://we.phorge.it/D25825

Details

Provenance
Andre KlapperAuthored on Sep 18 2024, 6:00 AM
themackabuPushed on Tue, Mar 25, 8:07 PM
Parents
rPb253675917c6: mimemailparser: Fix implicitly nullable parameter declarations for PHP 8.4
Branches
Unknown
Tags
Unknown

Event Timeline