Fix error when posix_getpwuid returns false

The posix_getpwuid function can return false if it fails (see [docs](https://www.php.net/manual/en/function.posix-getpwuid.php#:~:text=The%20function%20returns%20false%20on%20failure.)).
This commit is contained in:
Ed Wilde 2022-05-04 09:05:19 +12:00 committed by GitHub
parent 6ced576b2f
commit 0b6b2d1524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ class TempFolder
$user = ''; $user = '';
if (function_exists('posix_getpwuid') && function_exists('posix_getuid')) { if (function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
$userDetails = posix_getpwuid(posix_getuid()); $userDetails = posix_getpwuid(posix_getuid());
$user = $userDetails['name']; $user = $userDetails['name'] ?? false;
} }
if (!$user) { if (!$user) {
$user = Environment::getEnv('APACHE_RUN_USER'); $user = Environment::getEnv('APACHE_RUN_USER');