DB crash when copying event scheduled reminders
Overview
I am experiencing a crash when creating a new event from a template that has scheduled reminders, or trying to copy an event which has scheduled reminders.
The DB error suggests it is trying to put 0s in the effective_start_date / effective_end_date columns when creating the new scheduled reminders, but this is not allowed.
After the crash, the new event has been created but doesn't have the scheduled reminders it should.
Reproduction steps
- Events -> New Event.
- Choose a template with scheduled reminders
- Click Continue
- Fatal db error page :(
OR
- Events -> Manage Events
- Pick an event with scheduled reminders
- More -> Copy
- Fatal db error page :(
Current behaviour
Error from logs is:
.../sites/all/modules/civicrm/vendor/pear/db/DB.php(997): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...")
#3 .../sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...")
#4 .../sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...", "DB_Error", TRUE)
#5 .../sites/all/modules/civicrm/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7))
#6 .../sites/all/modules/civicrm/vendor/pear/db/DB/mysqli.php(936): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO `civicrm_action_schedule` (`name` , `title` , `recipient` , `enti...", "1292 ** Incorrect datetime value: '0' for column 'effective_start_date' at row 1")
After the crash, new/copied event is created but without scheduled reminders.
Expected behaviour
No error and new/copied event created with copies of scheduled reminders
Environment information
- CiviCRM: 5.35
- PHP: 7.3.17
- CMS: Drupal 7.8
- Database: MySQL 5.7.30
Comments
I see effective_start_date and effective_end_date columns were added in 5.34 and I wonder if something around the database schema constraints/defaults wasn't set correctly in the/my upgrade?