Registration creation service leaks data

Created on 5 June 2024, 6 months ago
Updated 21 June 2024, 5 months ago

Problem/Motivation

The RegistrationCreationService is a stateful object which stores data internally. Since the service is not declared as a non-shared service, it is leaking its state to any code that retrieves the service from the container.

Steps to reproduce

// Run some code that sets an event instance on the service (e.g. `EventInstanceCapacity::render()`).
// ...

// Now in some later running code retrieve the service.
$service = \Drupal::service('recurring_events_registration.creation_service')
// We should have a clean instance of the service, but the data from the previous code is still present.
assert(empty($service->getEventInstance()), 'No data is leaked between uses of the service');

Proposed resolution

Mark the service as non-shared.

πŸ› Bug report
Status

Fixed

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