1
0
Fork 0
Commit Graph

10973 Commits (81ad4e7e58270afbc38e5fbd26edb45b884a2bfa)

Author SHA1 Message Date
Jordi Boggiano 8ce0ea300e
Fix pear repo preventing self-update from functioning, fixes #10049 2021-08-18 14:23:08 +02:00
Jordi Boggiano a72784c4da
Merge pull request #10057 from nicholsonjf/docs-double-pipe-note
Note in docs about how single pipes are treated
2021-08-18 12:11:09 +02:00
Jordi Boggiano 5c201687e5
Fix 7zip issues on windows when mixing forward and backslashes, fixes #10058 2021-08-18 11:55:51 +02:00
Jordi Boggiano b7bb7718fb
Merge pull request #10060 from goodjack/update-plugin-api-version-2.1.0
Update the Composer plugin API version to 2.1.0
2021-08-18 11:35:24 +02:00
Jordi Boggiano 91a1a471db
Fix path repo bug causing symlinks to be left behind when uninstalling, fixes #10023 2021-08-18 11:25:00 +02:00
Jordi Boggiano d465df434c
Make sure diagnose command can run without proc_open, refs #9253 2021-08-18 10:16:20 +02:00
Jordi Boggiano 60fe67086e
Make sure proc_open is not required for basic installs, refs #9253 2021-08-18 10:15:47 +02:00
Jordi Boggiano d6f4111f35
Fix php 5.3 support 2021-08-17 16:59:00 +02:00
Jordi Boggiano 46f2d9de48
Fix php 5.3 support 2021-08-17 16:53:16 +02:00
Jordi Boggiano ddd7920d2a
Fix corrupt archives in cache from getting the installs stuck forever, and make sure it fails only once, fixes #10028 2021-08-17 16:49:36 +02:00
Jordi Boggiano e49f24e355
Switch phar signatures to sha512 2021-08-17 15:58:27 +02:00
小克 d9a94b376a
Update the Composer plugin API version to 2.1.0 2021-08-17 18:36:08 +08:00
James Nicholson 2d79f3381b Single pipe note 2021-08-13 13:50:38 -04:00
Jordi Boggiano 4da1a2d43a
Merge pull request #10050 from jrfnl/feature/10037-classmapgenerator-bug-fixes
ClassMapGenerator: fix two bugs (long heredocs + markers in text)
2021-08-12 16:24:45 +02:00
jrfnl 7004e0d031 PHP 8.1/LibraryInstallerTest: add missing mock expectation
The `LibraryInstallerTest::testUninstall()` method mocks a `Package` object, but did not set an expectation for a call to `getName()`, while that method _is_ called in the `LibraryInstaller::uninstall()` method.

Without expectation, the mock returns `null`, which was subsequently being passed on to `strpos()` leading to the below error.

Fixes:
```
Deprecation triggered by Composer\Test\Installer\LibraryInstallerTest::testUninstall:
strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 202)
1 src/Composer/Installer/LibraryInstaller.php(202): strpos(NULL, '...')
2 vendor/react/promise/src/FulfilledPromise.php(28): Composer\Installer\LibraryInstaller->Composer\Installer\{closure}(NULL)
3 src/Composer/Installer/LibraryInstaller.php(208): React\Promise\FulfilledPromise->then(Object(Closure))
4 tests/Composer/Test/Installer/LibraryInstallerTest.php(221): Composer\Installer\LibraryInstaller->uninstall(Object(Mock_InstalledRepositoryInterface_e3699f95), Object(Mock_Package_e4571076))
...
```
2021-08-12 03:38:56 +02:00
jrfnl 7022ceb0a6 PHP 8.1: prevent a "null to non-nullable" deprecation notice (test only fix)
Not all tests in the `InstallerTest` class actually create a temporary directory and set the `$this->tempComposerHome` property.

Those tests which didn't, throw a notice in PHP 8.1.

Fixes 3 notices along the lines of:
```
Deprecation triggered by Composer\Test\InstallerTest::tearDown:
is_dir(): Passing null to parameter #1 ($filename) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 53)
1 tests/Composer/Test/InstallerTest.php(53): is_dir(NULL)
...
```
2021-08-12 03:02:19 +02:00
jrfnl 609007b072 PHP 8.1: prevent a "null to non-nullable" deprecation notice
Discovered while running the existing unit tests on PHP 8.1.

The default state of the protected `$distUrl` property is "not set" and the property may not be set when the `Package::setSourceDistReferences()` method gets called.

Fixes a total of 9 deprecation notices along the lines of:
```
Deprecation triggered by Composer\Test\DependencyResolver\PoolBuilderTest::testPoolBuilder:
preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 597)
1 src/Composer/Package/Package.php(597): preg_match('...', NULL)
2 src/Composer/DependencyResolver/PoolBuilder.php(360): Composer\Package\Package->setSourceDistReferences('...')
3 src/Composer/DependencyResolver/PoolBuilder.php(338): Composer\DependencyResolver\PoolBuilder->loadPackage(Object(Composer\DependencyResolver\Request), Object(Composer\Package\CompletePackage))
4 src/Composer/DependencyResolver/PoolBuilder.php(195): Composer\DependencyResolver\PoolBuilder->loadPackagesMarkedForLoading(Object(Composer\DependencyResolver\Request), Array)
5 src/Composer/Repository/RepositorySet.php(229): Composer\DependencyResolver\PoolBuilder->buildPool(Array, Object(Composer\DependencyResolver\Request))
6 tests/Composer/Test/DependencyResolver/PoolBuilderTest.php(110): Composer\Repository\RepositorySet->createPool(Object(Composer\DependencyResolver\Request), Object(Composer\IO\NullIO))
...
```

Side-note: I'm wondering why `$this->getDistUrl()` is used instead of using the `$distUrl` property. It is a property within the same class after all. Haven't changed it, but did want to raise the question.

Refs:
* https://www.php.net/manual/en/function.preg-match.php
* https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
2021-08-12 02:45:29 +02:00
jrfnl 42c6a0d7c5 ClassMapGenerator: fix the regex
By using a look ahead assertion to match "new line - maybe whitespace - marker", the negative performance impact of the `.*` is significantly mitigated and backtracing will be severely limited.

This fixes the bug as reported in 10037.

The bug was discovered due to a PHP 8.1 "passing null to non-nullable" deprecation notice being thrown, but is not a PHP 8.1 bug.

In actual fact, this issue affected all PHP versions and could lead to incomplete classmaps when the code base contained files with huge heredocs/nowdocs.

The regex change (not completely) incidentally also fixes an issue with markers in a heredoc/nowdoc not being correctly handled. This bug could lead to "classes" being added to the class map which aren't actually classes.

Fixes 10037
2021-08-11 22:26:12 +02:00
jrfnl e729c418dd ClassMapGenerator: add test for "marker in text" bug
In PHP < 7.3, the heredoc/nowdoc marker was allowed to occur in the text, as long as it did not occur at the very start of the line.

This was also not handled correctly.

Ref: https://www.php.net/manual/en/migration73.incompatible.php#migration73.incompatible.core.heredoc-nowdoc
2021-08-11 22:23:24 +02:00
jrfnl 9588654ae3 ClassMapGenerator: add tests for "long heredoc" bug
... to proof the existence of the bug and demonstrate the effect.

Note: in the test the backtrack limit is being lowered (and restored back to the default afterwards) to prevent the tests needing ridiculously huge test fixture files.
2021-08-11 22:21:57 +02:00
Stephan c65bd832d6
Url: fix sanitize for new github tokens (#10048) 2021-08-11 13:24:41 +02:00
Juliette c7d11f361c
PHP 8.1: fix more return type deprecation warnings (#10039)
Follow up on 10008 and the various commits made for that.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2021-08-11 13:06:47 +02:00
Juliette f5a0dfeb50
PHP 8.1: fix deprecation warnings about incorrect default values (#10036)
* PHP 8.1/Tests: fix some deprecation warnings

The default value for the `preg_split()` `$limit` parameter is `-1`, not `null`.

Fixes numerous `preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated` notices when running the test suite.

Ref: https://www.php.net/manual/en/function.preg-split.php

* PHP 8.1/NoProxyPattern: fix deprecation warning

The default value for the `preg_split()` `$limit` parameter is `-1`, not `null`.

Fixes some `preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated` notices when running the test suite.

```
Deprecation triggered by Composer\Test\Util\Http\ProxyManagerTest::testGetProxyForRequest:
preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 42)
1 src/Composer/Util/NoProxyPattern.php(42): preg_split('...', '...', NULL, 1)
2 src/Composer/Util/Http/ProxyManager.php(148): Composer\Util\NoProxyPattern->__construct('...')
3 src/Composer/Util/Http/ProxyManager.php(50): Composer\Util\Http\ProxyManager->initProxyData()
4 src/Composer/Util/Http/ProxyManager.php(59): Composer\Util\Http\ProxyManager->__construct()
5 tests/Composer/Test/Util/Http/ProxyManagerTest.php(75): Composer\Util\Http\ProxyManager::getInstance()
...
```

Ref: https://www.php.net/manual/en/function.preg-split.php

* PHP 8.1: fix deprecation warnings / http_build_query()

This fixes all relevant calls to the PHP native `http_build_query()` function.
The second parameter of which is the _optional_ `$numeric_prefix` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.
In this case, these function calls yielded a `http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without BC-break.

Fixes a few deprecation warnings found when running the tests.

Refs:
* https://www.php.net/manual/en/function.http-build-query.php
* https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

* PHP 8.1: fix deprecation notices / PharData::__construct()

This fixes all relevant calls to the PHP native `PharData::__construct()` method.

The second parameter of this method is the _optional_ `$flags` parameter which expects an `int` of flags to be passed to the `Phar` parent class `RecursiveDirectoryIterator`.
Fixed by passing the default value for the `$flags` parameter as per the `RecursiveDirectoryIterator::__construct()` method.

The third parameter of the method is the _optional_ `$alias` parameter which expects an `string`.
Fixed by passing an empty string.

Fixes various notices along the lines of:
```
Deprecation triggered by Composer\Test\Package\Archiver\ArchiveManagerTest::testArchiveTar:
PharData::__construct(): Passing null to parameter #2 ($flags) of type int is deprecated

Stack trace:
0 [internal function]: Symfony\Bridge\PhpUnit\DeprecationErrorHandler->handleError(8192, '...', '...', 55)
1 src/Composer/Package/Archiver/PharArchiver.php(55): PharData->__construct('...', NULL, NULL, 2)
2 src/Composer/Package/Archiver/ArchiveManager.php(193): Composer\Package\Archiver\PharArchiver->archive('...', '...', '...', Array, false)
3 tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php(65): Composer\Package\Archiver\ArchiveManager->archive(Object(Composer\Package\CompletePackage), '...', '...')
...
```

Refs:
* https://www.php.net/manual/en/phardata.construct.php
* https://www.php.net/manual/en/recursivedirectoryiterator.construct.php

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2021-08-11 13:05:45 +02:00
John Stevenson 93f2e5f8fc
Update to xdebug-handler 2.0.2 (#10047) 2021-08-11 13:02:22 +02:00
Jordi Boggiano df99150db6
Pin versions to avoid new dependencies breaking tests 2021-08-04 16:39:19 +02:00
Jordi Boggiano 2665f1b282
Fix private property access, fixes #10022 2021-07-28 14:33:47 +02:00
Jordi Boggiano 2fb53232d1
Fix usage on symfony 2.x, fixes #10022 2021-07-28 14:19:19 +02:00
Jordi Boggiano bbe3769bcd
Update changelog 2021-07-23 10:35:14 +02:00
Jordi Boggiano deb4c48bbc
Avoid using an invalid path for InstalledFilesystemRepo in create-project and use an array repo instead, fixes #10020, fixes #10021 2021-07-23 10:09:31 +02:00
Jordi Boggiano 1f4401005c
Allow default_socket_timeout to extend the curl timeout if it is longer than 300s, fixes #10018 2021-07-23 09:51:57 +02:00
GeoSot e07d2a7bef
Respect parent setting, handling exceptions (#10017) 2021-07-22 15:14:15 +02:00
Jordi Boggiano a5ee2269ef
Update changelog 2021-07-22 13:55:15 +02:00
Jordi Boggiano 2f83338d2f
Fix hopefully last php 8.1 deprecation warnings 2021-07-22 13:54:18 +02:00
Jordi Boggiano 24f5e54fbe
Fix only/exclude to avoid matching names as sub-strings of full package names, fixes #10001 2021-07-22 13:47:31 +02:00
Jordi Boggiano 29a52ff463
Register ErrorHandler early to catch deprecation notices while the Application is being initialized 2021-07-22 12:58:14 +02:00
Jordi Boggiano 5413faec49
Merge pull request #10016 from tdutrion/patch-1
Highlight the proprietary license trick
2021-07-22 12:43:08 +02:00
Jordi Boggiano 2be03f0d60
More fixes for php8.1 deprecations 2021-07-22 12:42:01 +02:00
Thomas Dutrion 82a7c527f9
Highlight the proprietary license trick
From the Symfony Dev #french slack channel (symfony-devs.slack.com), people look confused regarding the value to use as license for proprietary projects, even though it's written in the documentation.

Because proprietary software is still a massive part of composer's usage, I think it can be interesting to have it as a note, more readable to people.

Extract from the conversation:
> J’étais sur la bonne page, il me manquait deux lignes de scroll pour voir ça -.- On a tous nos petits moments de faiblesse

Which roughly translates to:
> I was looking at the right page, just about two lines above... We all have our weak moments
2021-07-22 12:08:25 +02:00
Jordi Boggiano a7efb27338
More php8.1 deprecation fixes, refs #10008 2021-07-22 11:48:30 +02:00
Jordi Boggiano 47cf602f9e
Fix more PHP 8.1 deprecations, refs #10008 2021-07-22 11:30:01 +02:00
Jordi Boggiano 10ae1d7b08
Fix some PHP 8.1 deprecation warnings, fixes #10008 2021-07-21 15:13:24 +02:00
Jordi Boggiano f5a03b950d
Improve error reporting in require command, fixes invalid case of consistency issue, fixes #10006 2021-07-21 14:38:10 +02:00
Ondrej Mirtes 79093d664b Update PHPStan and remove ignore 2021-07-21 10:10:09 +02:00
Jordi Boggiano 052a455672
Merge pull request #10002 from ondrejmirtes/patch-2
Simplify code
2021-07-15 14:49:00 +02:00
Ondřej Mirtes 58ced29a2a
Simplify code 2021-07-14 16:36:12 +02:00
Jordi Boggiano be58b36a35
Also look up 7zz on linux/macOS, fixes #9951 2021-07-12 15:50:02 +02:00
Jordi Boggiano b602b19f6d
Fix archive command now that zips are extracted async, refs composer/satis#655 2021-07-12 15:09:59 +02:00
Jordi Boggiano db1d9e75be
Fix support for 7z command fallback on linux/macOS, fixes #9994 2021-07-12 14:49:44 +02:00
Jordi Boggiano bacbd15b6b
Fix open_basedir support regession in bfea0f7d1 2021-07-12 14:34:18 +02:00
Jordi Boggiano 5152eeebdc
Merge pull request #9995 from Seldaek/fix_wsl
Fix UNC/WSL-path issues when running in Windows
2021-07-12 14:07:41 +02:00