From d0e780a8eb21502070baa8000c1682a62a1a7284 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 21 May 2017 16:24:35 +0200 Subject: [PATCH] Allow php_uname to be disabled, fixes composer/getcomposer.org#112 --- src/Composer/Console/Application.php | 2 +- src/Composer/Util/StreamContextFactory.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index a2165ea76..d6b265f53 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -159,7 +159,7 @@ class Application extends BaseApplication Composer::VERSION, Composer::RELEASE_DATE, defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION, - php_uname('s') . ' / ' . php_uname('r') + function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS' ), true, IOInterface::DEBUG); if (PHP_VERSION_ID < 50302) { diff --git a/src/Composer/Util/StreamContextFactory.php b/src/Composer/Util/StreamContextFactory.php index 9fd28388d..0a6764418 100644 --- a/src/Composer/Util/StreamContextFactory.php +++ b/src/Composer/Util/StreamContextFactory.php @@ -143,8 +143,8 @@ final class StreamContextFactory $options['http']['header'][] = sprintf( 'User-Agent: Composer/%s (%s; %s; %s%s)', Composer::VERSION === '@package_version@' ? 'source' : Composer::VERSION, - php_uname('s'), - php_uname('r'), + function_exists('php_uname') ? php_uname('s') : 'Unknown', + function_exists('php_uname') ? php_uname('r') : 'Unknown', $phpVersion, getenv('CI') ? '; CI' : '' );