From 470bb4931b05cdc3c6d5b2ef9293e60e141b6eef Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 5 Sep 2013 16:51:13 -0700 Subject: [PATCH] Fix a warning in the JIRA field Summary: Ref T3687. The `value` property may be `null`. Test Plan: Loaded a revision with the JIRA field enabled but no issues attached, no longer saw a warning about a bad argument to `foreach()`. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T3687 Differential Revision: https://secure.phabricator.com/D6890 --- .../DifferentialJIRAIssuesFieldSpecification.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.php b/src/applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.php index a80551f46f..5d55de51c1 100644 --- a/src/applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialJIRAIssuesFieldSpecification.php @@ -145,12 +145,14 @@ final class DifferentialJIRAIssuesFieldSpecification $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); $refs = array(); - foreach ($this->value as $jira_key) { - $refs[] = id(new DoorkeeperObjectRef()) - ->setApplicationType(DoorkeeperBridgeJIRA::APPTYPE_JIRA) - ->setApplicationDomain($provider->getProviderDomain()) - ->setObjectType(DoorkeeperBridgeJIRA::OBJTYPE_ISSUE) - ->setObjectID($jira_key); + if ($this->value) { + foreach ($this->value as $jira_key) { + $refs[] = id(new DoorkeeperObjectRef()) + ->setApplicationType(DoorkeeperBridgeJIRA::APPTYPE_JIRA) + ->setApplicationDomain($provider->getProviderDomain()) + ->setObjectType(DoorkeeperBridgeJIRA::OBJTYPE_ISSUE) + ->setObjectID($jira_key); + } } return $refs;