Scheduled Registration + Instance Registration with "Custom schedule" option allows empty amount values

Created on 25 August 2025, 8 days ago

Problem/Motivation

It's possible to save an event series with the following options:
- Registration Type = Individual Event Registration
- Registration Dates = Scheduled Registration
- Registration Opens and/or Registration Closes = Custom schedule
- the related "amount" field -- either instance_schedule_open_amount or instance_schedule_close_amount = 0 or empty

Doing this causes problems in RegistrationCreationService::registrationOpeningClosingTime where lines like $reg_start->modify($open_time_modifier); try to modify a DateTime object with an empty value.

DateMalformedStringException: DateTime::modify(): Failed to parse time string () at position 0 ( ): Empty string in DateTime->modify() (line 366 of /var/www/html/web/core/lib/Drupal/Component/Datetime/DateTimePlus.php).

Steps to reproduce

Create an event with the options above, making sure that instance_schedule_open_amount or instance_schedule_close_amount is empty when clicking on the event Save button. Notice that the event will save. The empty values are converted into zero values. If any content is viewed that requires RegistrationCreationService::registrationOpeningClosingTime, the DateMalformedStringException will be triggered. For example, viewing the event instance will trigger RegistrationCreationService::registrationIsOpen, which calls RegistrationCreationService::registrationOpeningClosingTime

Proposed resolution

Ensure the event creation form checks for empty or zero values in these fields and returns form errors in those cases. Change the #min value for each number input to 1 instead of 0. Possibly add more checks in RegistrationCreationService::registrationOpeningClosingTime to triple-check that these fields have a value.

🐛 Bug report
Status

Active

Version

2.0

Component

Recurring Events Registration (Submodule)

Created by

🇨🇦Canada endless_wander

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024