Issue #3593033 by Frank Mably: settings form fatals on $fileSystem after an AJAX rebuild

Fixes the fatal in AuditTrailSettingsForm::validateForm() after an AJAX rebuild.

The settings form has #ajax (the effective-delays preview), so Drupal serializes the form object into the form cache. FormBase uses DependencySerializationTrait, whose __wakeup() re-injects service properties by assigning them. The injected file_system property was private readonly: readonly forbids writes outside the constructor, and a private service property is not reliably re-injected, so after an AJAX rebuild the property was uninitialized.

Fix: declare the injected service protected and non-readonly so the trait can restore it on wakeup.

Full reproduction steps and root cause are in the issue.

Merge request reports

Loading