From 71896b07770730a88dbee5d3063042f05970cd16 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 31 Jan 2018 14:06:54 +0100 Subject: [PATCH] Fix self-update regression, fixes #7045 --- src/Composer/Command/SelfUpdateCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 3ed72bdbc..52f7b87f0 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -111,8 +111,8 @@ EOT if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) { $composeUser = posix_getpwuid(posix_geteuid()); $homeOwner = posix_getpwuid(fileowner($home)); - if ($composeUser !== $homeOwner) { - $io->writeError('You are running composer as "'.$composeUser.'", while "'.$home.'" is owned by "'.$homeOwner.'"'); + if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) { + $io->writeError('You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"'); } }