From 0ad05e911b21436431956386793d626e83f10505 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 9 Apr 2013 11:27:37 -0700 Subject: [PATCH] Fix startup issue with access log Summary: Fixes T2930. We may not have an access log here yet -- I got a little too overeager with D5533. Test Plan: Faked gpc quotes and got a nice error instead of a blank screen: {F39821} Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T2930 Differential Revision: https://secure.phabricator.com/D5630 --- support/PhabricatorStartup.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/support/PhabricatorStartup.php b/support/PhabricatorStartup.php index 8ee7de26bd..ebfcb8410b 100644 --- a/support/PhabricatorStartup.php +++ b/support/PhabricatorStartup.php @@ -191,14 +191,19 @@ final class PhabricatorStartup { self::endOutputCapture(); $access_log = self::getGlobal('log.access'); - try { - $access_log->setData( - array( - 'c' => 500, - )); - $access_log->write(); - } catch (Exception $ex) { - $message .= "\n(Moreover, unable to write to access log.)"; + if ($access_log) { + // We may end up here before the access log is initialized, e.g. from + // verifyPHP(). + + try { + $access_log->setData( + array( + 'c' => 500, + )); + $access_log->write(); + } catch (Exception $ex) { + $message .= "\n(Moreover, unable to write to access log.)"; + } } header(