1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Fix two issues where StandardPageView assumes it will always have access to a user

Summary: If we hit an exception very early, the request may not have a user yet. Don't assume it will.

Test Plan: Broke MySQL config on purpose to test some stuff, loaded Phabricator, got a nice error page instead of a super-fatal one.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D7286
This commit is contained in:
epriestley 2013-10-12 17:08:47 -07:00
parent 130a15b51b
commit 122f643d6f

View file

@ -202,8 +202,14 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
require_celerity_resource('javelin-behavior-error-log'); require_celerity_resource('javelin-behavior-error-log');
} }
if ($user) {
$viewer = $user;
} else {
$viewer = new PhabricatorUser();
}
$menu = id(new PhabricatorMainMenuView()) $menu = id(new PhabricatorMainMenuView())
->setUser($request->getUser()) ->setUser($viewer)
->setDefaultSearchScope($this->getSearchDefaultScope()); ->setDefaultSearchScope($this->getSearchDefaultScope());
if ($this->getController()) { if ($this->getController()) {
@ -345,7 +351,7 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView {
$user = $request->getUser(); $user = $request->getUser();
$container = null; $container = null;
if ($user->isLoggedIn()) { if ($user && $user->isLoggedIn()) {
$aphlict_object_id = celerity_generate_unique_node_id(); $aphlict_object_id = celerity_generate_unique_node_id();
$aphlict_container_id = celerity_generate_unique_node_id(); $aphlict_container_id = celerity_generate_unique_node_id();