Page MenuHomePhabricator

Fix trivial errors in various View controllers
Closed, ResolvedPublic

Description

[Fri May 05 17:30:22 2017] [error] [client 10.45.206.131] [2017-05-05 17:30:22] ERROR 2: Invalid argument supplied for foreach() at [/home/ee-phabricator-service/phabtw/phabricator/src/applications/audit/view/PhabricatorAuditListView.php:113]

Similar, from Phacility production:

[Fri May 05 17:36:15.894500 2017] [:error] [pid 28743] [client 172.30.0.164:15639] [2017-05-05 17:36:15] ERROR 2: Invalid argument supplied for foreach() at [/core/lib/phabricator/src/applications/differential/view/DifferentialRevisionListView.php:53]
[Fri May 05 17:36:15.897388 2017] [:error] [pid 28743] [client 172.30.0.164:15639] [2017-05-05 17:36:15] ERROR 2: Invalid argument supplied for foreach() at [/core/lib/phabricator/src/applications/differential/view/DifferentialRevisionListView.php:74]
[Thu May 04 10:01:05.392320 2017] [:error] [pid 32162] [client 172.30.0.192:61698] [2017-05-04 10:01:05] ERROR 2: Invalid argument supplied for foreach() at [/core/lib/phabricator/src/applications/audit/view/PhabricatorAuditListView.php:87]

At first glance, these are likely because private $commits is not initialized to array(), plus a similar issue in Differential. Fixing is likely:

  • Reproduce these errors, probably by running a query in Audit and Differential which hits nothing (e.g., authored by a fake user?) so you get the same stuff in your local log.
  • Add = array(); to fix them, and/or fix the callers to always pass a list even if it is empty.
  • Verify that they no longer fire.