Problem/Motivation

When sending a test email using /admin/config/system/mailer/test, the process may throw PHP errors due to missing or empty parameters passed to the Symfony Mailer integration.

Example in logs:

TypeError: stristr(): Argument #1 ($haystack) must be of type string, array given
in core/modules/editor/src/Plugin/Filter/EditorFileReference.php:83

The problem occurs because some message parameters—particularly body, to, from, and subject—can be empty or even empty arrays when the mail is generated via the Mailer test form.

Steps to reproduce

  1. Enable the Symfony Mailer module.
  2. Go to /admin/config/system/mailer/test.
  3. Leave one or more fields empty (e.g. Body, Subject, From).
  4. Click “Send test mail”.
  5. Get errors like:
    TypeError: stristr(): Argument #1 ($haystack) must be of type string, array given
    or
    TypeError: Drupal\symfony_mailer\Address::__construct(): Argument #1 ($email) must be of type string, null given

Proposed resolution

Add proper checks before using message parameters when building or sending test mails. Specifically:

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

evamtinez created an issue. See original summary.

evamtinez’s picture

Fixed in #3555795

facine’s picture

Status: Active » Closed (outdated)

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.