From c56886ac36f71b9b7f335ae767ddabcabf96e84a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 7 Feb 2020 22:33:39 +0100 Subject: [PATCH] Avoid checking for .dockerenv if open_basedir is set, fixes #8585 --- src/Composer/Console/Application.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 6de2ee5d4..b884de15e 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -220,7 +220,12 @@ class Application extends BaseApplication $io->writeError(sprintf('Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.', $_SERVER['PHP_SELF'])); } - if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER') && !file_exists('/.dockerenv')) { + if ( + !Platform::isWindows() + && function_exists('exec') + && !getenv('COMPOSER_ALLOW_SUPERUSER') + && (ini_get('open_basedir') || !file_exists('/.dockerenv')) + ) { if (function_exists('posix_getuid') && posix_getuid() === 0) { if ($commandName !== 'self-update' && $commandName !== 'selfupdate') { $io->writeError('Do not run Composer as root/super user! See https://getcomposer.org/root for details');