diff --git a/src/SDK/Resource/Detectors/Process.php b/src/SDK/Resource/Detectors/Process.php index 19e1a3689..86cf6ea27 100644 --- a/src/SDK/Resource/Detectors/Process.php +++ b/src/SDK/Resource/Detectors/Process.php @@ -27,8 +27,9 @@ public function getResource(): ResourceInfo $attributes[ResourceAttributes::PROCESS_COMMAND_ARGS] = $_SERVER['argv']; } - if (extension_loaded('posix')) { - $attributes[ResourceAttributes::PROCESS_OWNER] = \posix_getpwuid(\posix_geteuid())['name']; + /** @phan-suppress-next-line PhanTypeComparisonFromArray */ + if (extension_loaded('posix') && ($user = \posix_getpwuid(\posix_geteuid())) !== false) { + $attributes[ResourceAttributes::PROCESS_OWNER] = $user['name']; } return ResourceInfo::create(Attributes::create($attributes), ResourceAttributes::SCHEMA_URL);