diff --git a/console.php b/console.php index 355b62ca2e66a..b2bc50c13d063 100644 --- a/console.php +++ b/console.php @@ -43,12 +43,13 @@ function exceptionHandler($exception) { $user = posix_getuid(); $userNameArray = posix_getpwuid($user); + $username = null; if ($userNameArray !== false) { $userName = $userNameArray['name']; } $configUser = fileowner(OC::$configDir . 'config.php'); $configuredUser = $config->getSystemValueString('php.user', ''); - if ($user !== $configUser && $userName !== $configuredUser) { + if ($user !== $configUser && $username !== null && $userName !== $configuredUser) { echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; echo "Current user id: " . $user . PHP_EOL; echo "Owner id of config.php: " . $configUser . PHP_EOL; diff --git a/cron.php b/cron.php index 9f2c7288589c3..d36ab67c650cc 100644 --- a/cron.php +++ b/cron.php @@ -131,12 +131,13 @@ $user = posix_getuid(); $userNameArray = posix_getpwuid($user); - if ($userNameArray !== false)) { + $username = null; + if ($userNameArray !== false) { $userName = $userNameArray['name']; } $configUser = fileowner(OC::$configDir . 'config.php'); $configuredUser = $config->getSystemValueString('php.user', ''); - if ($user !== $configUser && $userName !== $configuredUser) { + if ($user !== $configUser && $username !== null && $userName !== $configuredUser) { echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL; echo "Current user id: " . $user . PHP_EOL; echo "Owner id of config.php: " . $configUser . PHP_EOL;