From d8b9b523d41d17b1787ea189de643ad633e94e6d Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sun, 13 Dec 2015 17:50:02 +0100 Subject: [PATCH] baculum: Fix working with php-fpm --- gui/baculum/protected/Class/BaculumAPI.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/baculum/protected/Class/BaculumAPI.php b/gui/baculum/protected/Class/BaculumAPI.php index 67f5e22fa6..94236f6689 100644 --- a/gui/baculum/protected/Class/BaculumAPI.php +++ b/gui/baculum/protected/Class/BaculumAPI.php @@ -53,7 +53,11 @@ abstract class BaculumAPI extends TPage if(is_null($this->user) && $this->Application->getModule('configuration')->isApplicationConfig() === true) { $appConfig = ConfigurationManager::getApplicationConfig(); // @TOFIX: Baculum API layer should not use $_SERVER variables. - $this->user = isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] != $appConfig['baculum']['login'] ? $_SERVER['PHP_AUTH_USER'] : null; + if (isset($_SERVER['PHP_AUTH_USER'])) { + // NOTE: With php-fpm $_SERVER['PHP_AUTH_USER'] value is empty string here + $user = trim($_SERVER['PHP_AUTH_USER']); + $this->user = (!empty($user) && $user != $appConfig['baculum']['login']) ? $user : null; + } } switch($_SERVER['REQUEST_METHOD']) { -- 2.39.5