- Issue created by @pfrenssen
The NotificationService
in the recurring_event_registration
module is keeping local state but is stored on the dependency injection container as a reusable singleton. This causes it to leak it state in between calls. We should mark the service as non-shared, similar to what was done in
🐛
Registration creation service leaks data
Fixed
.
Even though this is a defect and the internal state of the service cannot be relied upon, there might be existing project code in the wild that is written expecting the state to be present, so this is a potential B/C break. We should fix this in the major 3.x release.
Let's also pay some attention to the RegistrantResendForm
that also seems to rely on a prefilled state.
// Run some code that instantiates the service (e.g. `recurring_events_registration_send_notification()`).
// ...
// Now in some later running code retrieve the service.
$service = \Drupal::service('recurring_events_registration.notification_service');
// We should have a clean instance of the service, but the data from the previous code is still present.
assert($service->getKey() === FALSE, 'No data is leaked between uses of the service');
Mark the service as non-shared.
Active
3.0
Recurring Events Registration (Submodule)