PHP fatal error when trying to install the module

Created on 2 June 2025, 5 days ago

Problem/Motivation

After a fresh composer require 'drupal/symfony_mailer:^2.0@alpha', either via drush or UI, try to enable the module (will enable both symfony_mailer and mailer_transport as one requires the other), and will cause the following error:

Fatal error: Trait "Drupal\symfony_mailer\AutowireTrait" not found in /var/www/html/web/modules/contrib/symfony_mailer/modules/mailer_transport/src/Plugin/TransportUI/DsnTransportUI.php on line 22

Steps to reproduce

- Fresh install
- drush en mailer_transport / drush en symfony_mailer
- Also valid via UI

Proposed resolution

Remaining tasks

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium gorkagr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @gorkagr
  • 🇬🇧United Kingdom adamps

    Thanks. The problem is that mailer_tranport is using that class from symfony_mailer without declaring a dependency and also symfony_mailer depends on mailer_tranport.

    This affects fresh installs only - I have various sites running with the current release. So 2 potential workarounds:

    1. upgrade from 1.x
    2. hack some files to allow install - might be enough just to comment out in two places in mailer_transport module use AutowireTrait; - then put back after installing
Production build 0.71.5 2024