Problem/Motivation

Update 20002 fails when upgrading from 1.6.2

>  [notice] Update started: symfony_mailer_update_20002
>  [error]  array_filter(): Argument #1 ($array) must be of type array, null given
>  [error]  Update failed: symfony_mailer_update_20002

Looking at array_filter() in symfony_mailer_update_20002, it seems that it needs symfony_mailer.settings.yml "override" key to be set, but I checked the yaml file, and there is no configuration key called override present. The only entry in symfony_mailer.settings.yml from 1.6.2 is default_transport.

Steps to reproduce

  1. Install symfony_mailer 1.6.2
  2. Update composer dependency eg composer require drupal/symfony_mailer:^2.0@beta -W
  3. Run drush updb.

Full output:

$ drush updb
>  [notice] Update started: symfony_mailer_update_20001
>  [notice] Update completed: symfony_mailer_update_20001
>  [notice] Update started: symfony_mailer_update_20002
>  [error]  array_filter(): Argument #1 ($array) must be of type array, null given
>  [error]  Update failed: symfony_mailer_update_20002
 [error]  Update aborted by: symfony_mailer_update_20002
 [error]  Finished performing updates.
Failed to execute command `drush updb`: exit status 1

Proposed resolution

Update the Config API ::get('override') call to use the second parameter (i.e., provide a default/fallback value):

-    $override = $settings->get('override');
+    $override = $settings->get('override', []);

Remaining tasks

User interface changes

API changes

Data model changes

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

jwilson3 created an issue. See original summary.

jwilson3’s picture

Issue summary: View changes

I'm not entirely certain what the "override" functionality is for. However, given my site running 1.6.2 didn't have a value set for this, I suggest updating the Config API ::get('override') call to use the second parameter (default/fallback value):

-    $override = $settings->get('override');
+    $override = $settings->get('override', []);

This seems to fix the issue for me, but I'm still testing things out.

jwilson3’s picture

Issue summary: View changes
jwilson3’s picture

It looks like the "override" functionality might be the mechanism for the mailer_override submodule to take over mail delivery from other modules (user, contact, commerce, simplenews, etc.) instead of letting them use Drupal's default mail system. The config key stores which modules have been overridden and their state.

My site was using simplenews and contact module, but somehow the override submodule appears to not be needed. The email-wrapper.html.twig is being used to render the correct HTML template for simplenews and contact module. (Dunno if that is the correct signal to look for or not though, tbh).

jwilson3’s picture

Status: Active » Needs review
jwilson3’s picture

Title: Update 20002 fails when upgrading from 1.6.2 » Update 20002 fails when mailer_override is not enabled
adamps’s picture

Thanks.

It looks like the "override" functionality might be the mechanism for the mailer_override submodule to take over mail delivery from other modules

Correct. It's an optional feature, and your site is fine not to use it.

The override value has been present in symfony_mailer.settings.yml since 1.3, and was initialised for older sites in symfony_mailer_update_10008(). However it looks like that update hook failed to set an empty-array value hence leading to this issue.

adamps’s picture

Title: Update 20002 fails when mailer_override is not enabled » Update 20002 fails when the `override` config setting is absent By: jwilson3 By: adamps
Status: Needs review » Fixed

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 committed a09f3ea1 on 2.x authored by jwilson3
    Bug: #3562761 Update 20002 fails when the `override` config setting is...

Status: Fixed » Closed (fixed)

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