mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +01:00
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
This commit is contained in:
parent
189fb2660a
commit
8b9428b6da
1 changed files with 11 additions and 17 deletions
|
@ -3,33 +3,27 @@
|
||||||
final class PhabricatorSubscriptionsListController
|
final class PhabricatorSubscriptionsListController
|
||||||
extends PhabricatorController {
|
extends PhabricatorController {
|
||||||
|
|
||||||
private $phid;
|
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->phid = idx($data, 'phid');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$viewer = $request->getUser();
|
$viewer = $request->getUser();
|
||||||
$phid = $this->phid;
|
|
||||||
|
|
||||||
$object = id(new PhabricatorObjectQuery())
|
$object = id(new PhabricatorObjectQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withPHIDs(array($phid))
|
->withPHIDs(array($request->getURIData('phid')))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
|
if (!$object) {
|
||||||
if ($object instanceof PhabricatorSubscribableInterface) {
|
return new Aphront404Response();
|
||||||
$subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
|
|
||||||
$phid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle_phids = $subscriber_phids;
|
if (!($object instanceof PhabricatorSubscribableInterface)) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
$phid = $object->getPHID();
|
||||||
|
|
||||||
|
$handle_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID($phid);
|
||||||
$handle_phids[] = $phid;
|
$handle_phids[] = $phid;
|
||||||
|
|
||||||
$handles = id(new PhabricatorHandleQuery())
|
$handles = id(new PhabricatorHandleQuery())
|
||||||
|
|
Loading…
Reference in a new issue