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
- Install symfony_mailer 1.6.2
- Update composer dependency eg
composer require drupal/symfony_mailer:^2.0@beta -W
- 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
Comments
Comment #2
jwilson3I'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):
This seems to fix the issue for me, but I'm still testing things out.
Comment #3
jwilson3Comment #4
jwilson3It 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).
Comment #6
jwilson3Comment #7
jwilson3Comment #8
adamps commentedThanks.
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.Comment #9
adamps commented