diff --git a/CHANGELOG.md b/CHANGELOG.md index ab1d3bba9a54..962a7759b343 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### [1.10.7] 2020-06-03 + + * Fix PHP 8 deprecations + * Fixed detection of pcntl_signal being in disabled_functions when pcntl_async_signal is allowed + ### [1.10.6] 2020-05-06 * Fixed version guessing to take composer-runtime-api and composer-plugin-api requirements into account to avoid selecting packages which require Composer 2 @@ -855,6 +860,7 @@ * Initial release +[1.10.7]: https://github.com/composer/composer/compare/1.10.6...1.10.7 [1.10.6]: https://github.com/composer/composer/compare/1.10.5...1.10.6 [1.10.5]: https://github.com/composer/composer/compare/1.10.4...1.10.5 [1.10.4]: https://github.com/composer/composer/compare/1.10.3...1.10.4 diff --git a/composer.json b/composer.json index e588cb71e06c..4fdbcb7431eb 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/semver": "^1.0", "composer/spdx-licenses": "^1.2", "composer/xdebug-handler": "^1.1", - "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "justinrainbow/json-schema": "^5.2.10", "psr/log": "^1.0", "seld/jsonlint": "^1.4", "seld/phar-utils": "^1.0", diff --git a/composer.lock b/composer.lock index aa67fc010774..1a5309f88402 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cb76dc8e228d462d248c09f0051da364", + "content-hash": "281c2bedcde245309c1f9c884f65e1a1", "packages": [ { "name": "composer/ca-bundle", @@ -60,6 +60,11 @@ "ssl", "tls" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/ca-bundle/issues", + "source": "https://github.com/composer/ca-bundle/tree/1.2.7" + }, "funding": [ { "url": "https://packagist.com", @@ -191,6 +196,11 @@ "spdx", "validator" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/spdx-licenses/issues", + "source": "https://github.com/composer/spdx-licenses/tree/1.5.3" + }, "time": "2020-02-14T07:44:31+00:00" }, { @@ -235,6 +245,11 @@ "Xdebug", "performance" ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/master" + }, "funding": [ { "url": "https://packagist.com", @@ -245,16 +260,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "5.2.9", + "version": "5.2.10", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "44c6787311242a979fa15c704327c20e7221a0e4" + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/44c6787311242a979fa15c704327c20e7221a0e4", - "reference": "44c6787311242a979fa15c704327c20e7221a0e4", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", "shasum": "" }, "require": { @@ -307,11 +322,7 @@ "json", "schema" ], - "support": { - "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/5.2.9" - }, - "time": "2019-09-25T14:49:45+00:00" + "time": "2020-05-27T16:41:55+00:00" }, { "name": "psr/log", @@ -468,6 +479,10 @@ "keywords": [ "phar" ], + "support": { + "issues": "https://github.com/Seldaek/phar-utils/issues", + "source": "https://github.com/Seldaek/phar-utils/tree/1.1.0" + }, "time": "2020-02-14T15:25:33+00:00" }, { @@ -701,16 +716,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", "shasum": "" }, "require": { @@ -722,7 +737,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -755,9 +770,6 @@ "polyfill", "portable" ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.15.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -772,20 +784,20 @@ "type": "tidelift" } ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:14:59+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", "shasum": "" }, "require": { @@ -797,7 +809,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -831,9 +843,6 @@ "portable", "shim" ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.15.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -848,7 +857,7 @@ "type": "tidelift" } ], - "time": "2020-03-09T19:04:49+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/process", @@ -1336,23 +1345,23 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v3.4.39", + "version": "v3.4.41", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "c02893ae43532b46a4f0e0f207d088b939f278d9" + "reference": "f926812c6b3d456dfbd13c706293f49e9a10bc2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/c02893ae43532b46a4f0e0f207d088b939f278d9", - "reference": "c02893ae43532b46a4f0e0f207d088b939f278d9", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/f926812c6b3d456dfbd13c706293f49e9a10bc2a", + "reference": "f926812c6b3d456dfbd13c706293f49e9a10bc2a", "shasum": "" }, "require": { "php": ">=5.3.3" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0" + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0|<6.4,>=6.0|9.1.2" }, "suggest": { "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" @@ -1397,9 +1406,6 @@ ], "description": "Symfony PHPUnit Bridge", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v3.4.38" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -1414,7 +1420,7 @@ "type": "tidelift" } ], - "time": "2020-02-21T08:01:47+00:00" + "time": "2020-05-21T18:33:26+00:00" } ], "aliases": [], diff --git a/doc/00-intro.md b/doc/00-intro.md index 897d23609618..ea88808a0ad5 100644 --- a/doc/00-intro.md +++ b/doc/00-intro.md @@ -10,7 +10,7 @@ Composer is **not** a package manager in the same sense as Yum or Apt are. Yes, it deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. `vendor`) inside your project. By default it does not install anything globally. Thus, it is a dependency -manager. It does however support a "global" project for convenience via the +manager. It does however support a "global" project for convenience via the [global](03-cli.md#global) command. This idea is not new and Composer is strongly inspired by node's @@ -58,7 +58,7 @@ project, or globally as a system wide executable. #### Locally -To install Composer locally, run the installer in your project directory. See +To install Composer locally, run the installer in your project directory. See [the Download page](https://getcomposer.org/download/) for instructions. The installer will check a few PHP settings and then download `composer.phar` @@ -134,8 +134,16 @@ to download `composer.phar`. Create a new `composer.bat` file alongside `composer.phar`: +Using cmd.exe: + +```sh +C:\bin> echo @php "%~dp0composer.phar" %*>composer.bat +``` + +Using PowerShell: + ```sh -C:\bin>echo @php "%~dp0composer.phar" %*>composer.bat +PS C:\bin> Set-Content composer.bat '@php "%~dp0composer.phar" %*' ``` Add the directory to your PATH environment variable if it isn't already. diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 1801583fd0f1..067fb9a40756 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -362,7 +362,7 @@ protected function installRootPackage(IOInterface $io, Config $config, $packageN } // handler Ctrl+C for unix-like systems - if (function_exists('pcntl_async_signals')) { + if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) { @mkdir($directory, 0777, true); if ($realDir = realpath($directory)) { pcntl_async_signals(true); diff --git a/src/Composer/Command/ExecCommand.php b/src/Composer/Command/ExecCommand.php index d530def6635a..fba9e7e8ac25 100644 --- a/src/Composer/Command/ExecCommand.php +++ b/src/Composer/Command/ExecCommand.php @@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { chdir($this->getApplication()->getInitialWorkingDirectory()); } catch (\Exception $e) { - throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getWorkingDirectory().'"', 0, $e); + throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e); } } diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index cbdfdaf9c7e9..9b59e7feb92a 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -84,7 +84,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { - if (function_exists('pcntl_async_signals')) { + if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) { pcntl_async_signals(true); pcntl_signal(SIGINT, array($this, 'revertComposerFile')); pcntl_signal(SIGTERM, array($this, 'revertComposerFile')); diff --git a/src/Composer/Composer.php b/src/Composer/Composer.php index a879a0dae593..1991ad13e8d8 100644 --- a/src/Composer/Composer.php +++ b/src/Composer/Composer.php @@ -45,14 +45,14 @@ class Composer * const SOURCE_VERSION = ''; * * source (git clone): - * const VERSION = '@package_version@'; - * const BRANCH_ALIAS_VERSION = '@package_branch_alias_version@'; - * const RELEASE_DATE = '@release_date@'; + * const VERSION = '1.10.7'; + * const BRANCH_ALIAS_VERSION = ''; + * const RELEASE_DATE = '2020-06-03 10:03:56'; * const SOURCE_VERSION = '1.8-dev+source'; */ - const VERSION = '@package_version@'; - const BRANCH_ALIAS_VERSION = '@package_branch_alias_version@'; - const RELEASE_DATE = '@release_date@'; + const VERSION = '1.10.7'; + const BRANCH_ALIAS_VERSION = ''; + const RELEASE_DATE = '2020-06-03 10:03:56'; const SOURCE_VERSION = '1.10-dev+source'; /** diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 6b2449d99551..3d4542a964d3 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -326,14 +326,23 @@ protected function checkListenerExpectedEvent($target, Event $event) return $event; } - $typehint = $reflected->getClass(); + $expected = null; + $isClass = false; + if (\PHP_VERSION_ID >= 70000) { + $reflectionType = $reflected->getType(); + if ($reflectionType) { + $expected = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType; + $isClass = !$reflectionType->isBuiltin(); + } + } else { + $expected = $reflected->getClass() ? $reflected->getClass()->getName() : null; + $isClass = null !== $expected; + } - if (!$typehint instanceof \ReflectionClass) { + if (!$isClass) { return $event; } - $expected = $typehint->getName(); - // BC support if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') { trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED); diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index 87b82d14d720..a724f644fcd5 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -127,8 +127,20 @@ public function createRepository($type, $config, $name = null) $reflMethod = new \ReflectionMethod($class, '__construct'); $params = $reflMethod->getParameters(); - if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') { - return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs); + if (isset($params[4])) { + $paramType = null; + if (\PHP_VERSION_ID >= 70000) { + $reflectionType = $params[4]->getType(); + if ($reflectionType) { + $paramType = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType; + } + } else { + $paramType = $params[4]->getClass() ? $params[4]->getClass()->getName() : null; + } + + if ($paramType === 'Composer\Util\RemoteFilesystem') { + return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs); + } } return new $class($config, $this->io, $this->config, $this->eventDispatcher);