Skip to content

Commit

Permalink
Return a dummy PHP username in case the POSIX module is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Meyer committed Oct 29, 2014
1 parent 81e06fe commit 4d8842d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/Icinga/Application/Platform.php
Expand Up @@ -152,8 +152,12 @@ public static function getPhpUser()
return get_current_user(); // http://php.net/manual/en/function.get-current-user.php#75059
}

$userInfo = posix_getpwuid(posix_geteuid());
return $userInfo['name'];
if (function_exists('posix_geteuid')) {
$userInfo = posix_getpwuid(posix_geteuid());
return $userInfo['name'];
}

return 'php_username';
}

/**
Expand Down

0 comments on commit 4d8842d

Please sign in to comment.