@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 exception accessing a non-existing EditEngine

Summary:
Trying to access a non-existing edit engine "foo" via the URI `/transactions/editengine/foo/` throws an unhandled exception.
`PhabricatorEditEngine::getByKey($viewer, $engine_key)` is null as `$engine_key` is non-existing `foo`.
Thus avoid calling `setViewer()` on `null` by splitting into a separate step after a null check.
When null, show a proper 404 error instead.

```
EXCEPTION: (Error) Call to a member function setViewer() on null at [<phorge>/src/applications/transactions/controller/PhabricatorEditEngineConfigurationListController.php:17]
```

Closes T15793

Test Plan:
While logged in and with sufficient permissions,
* go to non-existing http://phorge.localhost/transactions/editengine/whatever/ before and after applying patch,
* go to existing http://phorge.localhost/transactions/editengine/maniphest.task/ to see that existing stuff still works.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15793

Differential Revision: https://we.phorge.it/D25597

+3 -4
+3 -4
src/applications/transactions/controller/PhabricatorEditEngineConfigurationListController.php
··· 13 13 $engine_key = $request->getURIData('engineKey'); 14 14 $this->setEngineKey($engine_key); 15 15 16 - $engine = PhabricatorEditEngine::getByKey($viewer, $engine_key) 17 - ->setViewer($viewer); 18 - 19 - if (!$engine->isEngineConfigurable()) { 16 + $engine = PhabricatorEditEngine::getByKey($viewer, $engine_key); 17 + if (!$engine || !$engine->isEngineConfigurable()) { 20 18 return new Aphront404Response(); 21 19 } 20 + $engine->setViewer($viewer); 22 21 23 22 $items = array(); 24 23 $items[] = id(new PHUIListItemView())