Fatal error when registering for event without entering email

Created on 2 October 2024, 6 months ago

Problem/Motivation

When registering for an event, none of the fields in the RegistrantForm are required. When the form is submitted without entering an email address, a fatal error occurs.

Steps to reproduce

  1. Create an event series.
  2. Enable registration.
  3. Go to one of the event instances and click "Register".
  4. Don't fill in the email address, just scroll down and press "Register" again.

Result:

TypeError: Drupal\Core\Mail\Plugin\Mail\PhpMail::doMail(): Argument #1 ($to) must be of type string, null given, called in /var/www/html/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php on line 123 in Drupal\Core\Mail\Plugin\Mail\PhpMail->doMail() (line 168 of core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php).

Drupal\Core\Mail\Plugin\Mail\PhpMail->mail() (Line: 308)
Drupal\Core\Mail\MailManager->doMail() (Line: 181)
Drupal\Core\Mail\MailManager->Drupal\Core\Mail\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 180)
Drupal\Core\Mail\MailManager->mail() (Line: 426)
recurring_events_registration_send_notification() (Line: 96)
Drupal\recurring_events_registration\Entity\Registrant->postSave() (Line: 563)
Drupal\Core\Entity\EntityStorageBase->doPostSave() (Line: 781)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave() (Line: 489)
Drupal\Core\Entity\EntityStorageBase->save() (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 293)
Drupal\Core\Entity\EntityForm->save() (Line: 489)
Drupal\recurring_events_registration\Form\RegistrantForm->save()
call_user_func_array() (Line: 129)

Proposed resolution

Make the email base field required in Registrant::baseFieldDefinitions().

🐛 Bug report
Status

Active

Version

2.0

Component

Recurring Events Registration (Submodule)

Created by

🇧🇬Bulgaria pfrenssen Sofia

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