From 0ef1d4bc17bb9e0be7c571f0097a33653b61e5cc Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 30 Jun 2015 11:19:24 -0700 Subject: [PATCH] Don't try to load profile images for projects with no profile image Summary: Ref T8631. Projects may not have a profile image PHID; don't try to load it if they don't. Test Plan: Saw `WHERE phid IN ('')` query stop happening on a local feed story page. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8631 Differential Revision: https://secure.phabricator.com/D13476 --- .../project/query/PhabricatorProjectQuery.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php index bbb0857315..e607ff2dc5 100644 --- a/src/applications/project/query/PhabricatorProjectQuery.php +++ b/src/applications/project/query/PhabricatorProjectQuery.php @@ -196,12 +196,18 @@ final class PhabricatorProjectQuery $default = null; $file_phids = mpull($projects, 'getProfileImagePHID'); - $files = id(new PhabricatorFileQuery()) - ->setParentQuery($this) - ->setViewer($this->getViewer()) - ->withPHIDs($file_phids) - ->execute(); - $files = mpull($files, null, 'getPHID'); + $file_phids = array_filter($file_phids); + if ($file_phids) { + $files = id(new PhabricatorFileQuery()) + ->setParentQuery($this) + ->setViewer($this->getViewer()) + ->withPHIDs($file_phids) + ->execute(); + $files = mpull($files, null, 'getPHID'); + } else { + $files = array(); + } + foreach ($projects as $project) { $file = idx($files, $project->getProfileImagePHID()); if (!$file) {