@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix a possible undefined variable

Summary:
I pulled this out of the logs; not sure how anyone hit it, but this controller could bump into an undefined variable here:

```
2015/06/24 22:59:55 [error] 10150#0: *172493 FastCGI sent in stderr: "PHP message: [2015-06-24 22:59:55] EXCEPTION: (RuntimeException) Undefined variable: subscriber_phids at [<phutil>/src/error/PhutilErrorHandler.php:210]
PHP message: arcanist(head=master, ref.master=b697a3b80bdc), phabricator(head=redesign-2015, ref.master=0fd0f171f10f, ref.redesign-2015=1a5f986d73dd), phutil(head=master, ref.master=74c9cb3a266e)
PHP message: #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<phabricator>/src/applications/subscriptions/controller/PhabricatorSubscriptionsListController.php:32]
PHP message: #1 <#2> PhabricatorSubscriptionsListController::processRequest() called at [<phabricator>/src/aphront/AphrontController.php:33]
PHP message: #2 <#2> AphrontController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:226]
PHP message: #3 phlog(RuntimeException) called at [<phabricator>/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php:229]
PHP message: #4 AphrontDefaultApplicationConfiguration::handleException(RuntimeException) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:230]
PHP message: #5 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:140]
PHP message: #6 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:21]" while reading response header from upstream, client: 167.114.156.198, server: , request: "GET /subscriptions/list/phid-wiki-366842d394398204f305/ HTTP/1.1", upstream: "fastcgi://unix:/core/var/pool/fpm.sock:", host: "secure.phabricator.com"
```

Clean things up a bit.

Test Plan: Clicked "6 others" subscriber link on a task with a bunch of subscribers.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D13430

+10 -16
+10 -16
src/applications/subscriptions/controller/PhabricatorSubscriptionsListController.php
··· 3 3 final class PhabricatorSubscriptionsListController 4 4 extends PhabricatorController { 5 5 6 - private $phid; 7 - 8 - public function willProcessRequest(array $data) { 9 - $this->phid = idx($data, 'phid'); 10 - } 11 - 12 6 public function shouldAllowPublic() { 13 7 return true; 14 8 } 15 9 16 - public function processRequest() { 17 - $request = $this->getRequest(); 18 - 10 + public function handleRequest(AphrontRequest $request) { 19 11 $viewer = $request->getUser(); 20 - $phid = $this->phid; 21 - 22 12 $object = id(new PhabricatorObjectQuery()) 23 13 ->setViewer($viewer) 24 - ->withPHIDs(array($phid)) 14 + ->withPHIDs(array($request->getURIData('phid'))) 25 15 ->executeOne(); 16 + if (!$object) { 17 + return new Aphront404Response(); 18 + } 26 19 27 - if ($object instanceof PhabricatorSubscribableInterface) { 28 - $subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID( 29 - $phid); 20 + if (!($object instanceof PhabricatorSubscribableInterface)) { 21 + return new Aphront404Response(); 30 22 } 31 23 32 - $handle_phids = $subscriber_phids; 24 + $phid = $object->getPHID(); 25 + 26 + $handle_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID($phid); 33 27 $handle_phids[] = $phid; 34 28 35 29 $handles = id(new PhabricatorHandleQuery())