Invalid argument supplied for foreach: PhabricatorMetaMTAMail.php


Observed Behavior:
Phabricator hasn’t been sending email since mid-December. Any attempt to trigger one (for example, sending a user the greeting email) gets this written to the PHD log:

[10-Jan-2019 22:56:43 America/Chicago] [2019-01-10 22:56:43] ERROR 2: Invalid argument supplied for foreach() at [/phabricator/src/applications/metamta/storage/PhabricatorMetaMTAMail.php:527]
[10-Jan-2019 22:56:43 America/Chicago] arcanist(head=stable, ref.master=25c2381959ac, ref.stable=97ddb9d5a1be), phabricator(head=stable, ref.master=e8069dfe31c8, ref.stable=c7656312ec42), phutil(head=stable, ref.master=cad1985726c9, ref.stable=a537ba03c994)
[10-Jan-2019 22:56:43 America/Chicago] #0 PhabricatorMetaMTAMail::newMailers(array) called at [/src/applications/metamta/storage/PhabricatorMetaMTAMail.php:609]
[10-Jan-2019 22:56:43 America/Chicago] #1 PhabricatorMetaMTAMail::sendWithMailers(array) called at [/src/applications/metamta/storage/PhabricatorMetaMTAMail.php:508]
[10-Jan-2019 22:56:43 America/Chicago] #2 PhabricatorMetaMTAMail::sendNow() called at [/src/applications/metamta/PhabricatorMetaMTAWorker.php:22]
[10-Jan-2019 22:56:43 America/Chicago] #3 PhabricatorMetaMTAWorker::doWork() called at [/src/infrastructure/daemon/workers/PhabricatorWorker.php:123]
[10-Jan-2019 22:56:43 America/Chicago] #4 PhabricatorWorker::executeTask() called at [/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php:171]
[10-Jan-2019 22:56:43 America/Chicago] #5 PhabricatorWorkerActiveTask::executeTask() called at [/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php:22]
[10-Jan-2019 22:56:43 America/Chicago] #6 PhabricatorTaskmasterDaemon::run() called at [/src/daemon/PhutilDaemon.php:219]
[10-Jan-2019 22:56:43 America/Chicago] #7 PhutilDaemon::execute() called at [/scripts/daemon/exec/exec_daemon.php:131]

arcanist: 97ddb9d5a1be282d6002a875a759266bb97b653f
libphutil: a537ba03c994eca87698cc4b95d4db4570edc665
phabricator: c7656312ec4207b39fe3962fb350c9c33f17b4a3

I have been keeping up to date and restarting apache/phd.

php --version

PHP 7.3.0-2+0~20181217092659.24+stretch~1.gbp54e52f (cli) (built: Dec 17 2018 09:26:59) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright © 1998-2018 Zend Technologies
with Zend OPcache v7.3.0-2+0~20181217092659.24+stretch~1.gbp54e52f, Copyright © 1999-2018, by Zend Technologies

Expected Behavior:
Sending email!

Phabricator Version:

c7656312ec4207b39fe3962fb350c9c33f17b4a3 (Fri, Jan 4) (branched from 73e3057c52f46ec6ddb75fc495a03255c5199c16 on origin)


97ddb9d5a1be282d6002a875a759266bb97b653f (Fri, Dec 28) (branched from 25c2381959ac94d9249ae4023c5f9ea36436b81c on origin)


a537ba03c994eca87698cc4b95d4db4570edc665 (Sat, Dec 15) (branched from cad1985726c99e1225b95abf8a2bd1601a267fe4 on origin)


3.5 at /usr/bin/diff


2.11.0 at /usr/bin/git


Not Available


2.2.0 at /usr/bin/pygmentize


Not Available

Reproduction Steps:
Possibly a php 7.3 bug?


Have you reconfigured the mail subsystem, as it was changed recently (see e.g. D19940)? Check the Setup Issues (at /config/issue/, there should be a warning icon in the top toolbar, if you are logged-in as an administrator), if it complains about wrong mail configuration. You need to configure the cluster.mailers configuration variable, see Configuring Outbound Email.


Thank you for the feedback! If I go to setup issues, there is nothing about a mailer issue. If I do ./phabricator/bin/config get cluster.mailers I get this output:

{ "config": [ { "key": "cluster.mailers", "source": "local", "value": null, "status": "unset", "errorInfo": null }, { "key": "cluster.mailers", "source": "database", "value": null, "status": "unset", "errorInfo": null } ] }


@Mormegil is correct; you need to configure the cluster.mailers config key. See the instructions here:

I’ll double check that the code to raise a setup issue is working correctly.

#5 fixes the lack of guidance for users who have not yet configured cluster.mailers. Thanks for the report.


Thank you! I have it configured and confirmed working. Thanks for looking into the bug!


The actual error should also be fixed by