Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Handle cases where posix_getpwuid might return false #140

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ class ClientBuilder
public function __construct($yamlParser = null, $defaultFilePath = null)
{
if(function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
$this->defaultFile = posix_getpwuid(posix_getuid())['dir'] . '/' . $this->defaultFile;
$userInfo = posix_getpwuid(posix_getuid());

if (false !== $userInfo) {
$this->defaultFile = $userInfo['dir'] . '/' . $this->defaultFile;
}
}
if (null != $defaultFilePath) {
$this->defaultFile = $defaultFilePath;
Expand Down