Page MenuHomePhabricator

Invalid argument supplied for foreach
Closed, InvalidPublic

Description

I'm seeing a couple of these in our error logs:

[06-Mar-2015 11:01:10 Australia/Sydney] [2015-03-06 11:01:10] ERROR 2: Invalid argument supplied for foreach() at [/usr/src/phabricator/src/applications/differential/customfield/DifferentialReviewersField.php:190]
[06-Mar-2015 11:01:10 Australia/Sydney] arcanist(head=master, ref.master=c36b4ceb1849), phabricator(head=master, ref.master=9564b0a40e88), phlab(head=master, ref.master=4689d11dbe69), phutil(head=master, ref.master=eaa6ebecef8e)
[06-Mar-2015 11:01:10 Australia/Sydney]   #0 DifferentialReviewersField::validateCommitMessageValue(NULL) called at [<phabricator>/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php:74]
[06-Mar-2015 11:01:10 Australia/Sydney]   #1 DifferentialParseCommitMessageConduitAPIMethod::execute(ConduitAPIRequest) called at [<phabricator>/src/applications/conduit/method/ConduitAPIMethod.php:65]
[06-Mar-2015 11:01:10 Australia/Sydney]   #2 ConduitAPIMethod::executeMethod(ConduitAPIRequest) called at [<phabricator>/src/applications/conduit/call/ConduitCall.php:134]
[06-Mar-2015 11:01:10 Australia/Sydney]   #3 ConduitCall::executeMethod() called at [<phabricator>/src/applications/conduit/call/ConduitCall.php:84]
[06-Mar-2015 11:01:10 Australia/Sydney]   #4 ConduitCall::execute() called at [<phabricator>/src/applications/conduit/controller/PhabricatorConduitAPIController.php:88]
[06-Mar-2015 11:01:10 Australia/Sydney]   #5 PhabricatorConduitAPIController::processRequest() called at [<phabricator>/src/aphront/AphrontController.php:33]
[06-Mar-2015 11:01:10 Australia/Sydney]   #6 AphrontController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:196]
[06-Mar-2015 11:01:10 Australia/Sydney]   #7 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:121]
[06-Mar-2015 11:01:10 Australia/Sydney]   #8 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]

Revisions and Commits

Event Timeline

joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Differential.
joshuaspence added a subscriber: joshuaspence.

FWIW, we see this around 15 times per day (just grepping our PHP error logs).

I applied a patch locally in an attempt to troubleshoot this issue:

diff --git a/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php
index 107d22d..86d21a6 100644
--- a/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php
@@ -63,7 +63,7 @@ final class DifferentialParseCommitMessageConduitAPIMethod
           $ex->getMessage());
       }
     }
-
+    phlog(json_encode($values)); phlog(json_encode($field_map));
     if (!$is_partial) {
       foreach ($field_map as $key => $field) {
         try {

I'm seeing this in the logs:

[26-Aug-2015 18:26:18 Australia/Sydney] [2015-08-26 18:26:18] PHLOG: '{"title":{},"summary":{},"testPlan":{},"reviewerPHIDs":{},"reviewedByPHIDs":{},"ccPHIDs":{},"phabricator:projects":{},"maniphestTaskPHIDs":{},"jira.issues":{},"revisionID":{},"conflicts":{},"gitSVNID":{},"phabricator:auditors":{}}' at [/usr/src/phabricator/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php:66]
[26-Aug-2015 18:26:18 Australia/Sydney] [2015-08-26 18:26:18] ERROR 2: Invalid argument supplied for foreach() at [/usr/src/phabricator/src/applications/differential/customfield/DifferentialReviewersField.php:188]
[26-Aug-2015 18:26:18 Australia/Sydney] arcanist(head=master, ref.master=9b8c9d280ea4), phabricator(head=master, ref.master=c69d4658918c, custom=1), phlab(head=master, ref.master=c090c8485be5), phutil(head=master, ref.master=ff71c34f3e8f)
[26-Aug-2015 18:26:18 Australia/Sydney]   #0 DifferentialReviewersField::validateCommitMessageValue(NULL) called at [<phabricator>/src/applications/differential/conduit/DifferentialParseCommitMessageConduitAPIMethod.php:70]
[26-Aug-2015 18:26:18 Australia/Sydney]   #1 DifferentialParseCommitMessageConduitAPIMethod::execute(ConduitAPIRequest) called at [<phabricator>/src/applications/conduit/method/ConduitAPIMethod.php:113]
[26-Aug-2015 18:26:18 Australia/Sydney]   #2 ConduitAPIMethod::executeMethod(ConduitAPIRequest) called at [<phabricator>/src/applications/conduit/call/ConduitCall.php:135]
[26-Aug-2015 18:26:18 Australia/Sydney]   #3 ConduitCall::executeMethod() called at [<phabricator>/src/applications/conduit/call/ConduitCall.php:85]
[26-Aug-2015 18:26:18 Australia/Sydney]   #4 ConduitCall::execute() called at [<phabricator>/src/applications/conduit/controller/PhabricatorConduitAPIController.php:91]
[26-Aug-2015 18:26:18 Australia/Sydney]   #5 PhabricatorConduitAPIController::processRequest() called at [<phabricator>/src/aphront/AphrontController.php:33]
[26-Aug-2015 18:26:18 Australia/Sydney]   #6 AphrontController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:234]
[26-Aug-2015 18:26:18 Australia/Sydney]   #7 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:148]
[26-Aug-2015 18:26:18 Australia/Sydney]   #8 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:17]

So somehow, a completely blank object is being passed in. @epriestley, I'm not really sure what this code does, but happy to do some more debugging.

This recently got rewritten in connection with T11114 and I didn't come up with a way to reproduce it. Not sure if it's still an issue, but we need better reproduction steps if it is.