Core 10.5
DSM+ 2.x-dev

When I enable symfony_mailer, mailer_policy & mailer_override and go to mailer policy page this warning appears:

Warning: Undefined array key "required_config" in Drupal\mailer_policy\Form\PolicyEditForm->form() (line 40 of modules/contrib/symfony_mailer/modules/mailer_policy/src/Form/PolicyEditForm.php).
Drupal\mailer_policy\Form\PolicyEditForm->form() (Line: 107)

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

drupgirl created an issue. See original summary.

ushma’s picture

Assigned: Unassigned » ushma

ushma’s picture

Assigned: ushma » Unassigned
Status: Active » Needs review
StatusFileSize
new904 bytes

Hi , I have created an MR for the fix. Also attached associated patch for the same. Please review.

mach3.zone made their first commit to this issue’s fork.

mach3.zone’s picture

The error occurs, when trying to edit the root policy *All* on admin/config/system/mailer/policy/_
The problem was introduced with the issue Add support for required config
@ushma There is a second access to $mailer_definition['required_config'], while ordering the adjusters. Added ?? []

adamps’s picture

Priority: Normal » Major
Status: Needs review » Needs work

Thanks for the report.

Normally it is set by Drupal\symfony_mailer\Attribute\Mailer, however the *All* and *Unknown* policies don't have a definition - see MailerPolicy::parse().

The MR uses a case-by-case approach to handle the missing definition. However we can't know for sure that this is the end of the problem - there might be cases we didn't spot with other keys, or new ones might get added in the future. I would prefer instead an approach that creates an "empty" definition initialised with default values. This code be done with code similar to OverrideManager::getLegacyMailerDefinition(), except we don't need a subdef and we can't use LegacyMailer as the class.
Perhaps we could add a function MailerManager::createDummyDefinition() equal to most of getLegacyMailerDefinition() which then becomes a thin wrapper.

adamps’s picture

Status: Needs work » Fixed

Fixed similar to #7, thanks

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

adamps’s picture

The commit has been done. It isn't listed in the comments of this issue because the MR title didn't contain the issue number.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.