From 923ff98ea06ee9d9d886ef8de052bf4c9ce8cc26 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 26 Oct 2022 11:23:50 +0200 Subject: [PATCH 1/2] Update phpstan --- composer.lock | 26 +++++++++++++------------- phpstan/baseline.neon | 5 +++++ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 759c17594..d837b8d0d 100644 --- a/composer.lock +++ b/composer.lock @@ -1959,16 +1959,16 @@ "packages-dev": [ { "name": "phpstan/phpstan", - "version": "1.8.9", + "version": "1.8.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2" + "reference": "46e223dd68a620da18855c23046ddb00940b4014" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46e223dd68a620da18855c23046ddb00940b4014", + "reference": "46e223dd68a620da18855c23046ddb00940b4014", "shasum": "" }, "require": { @@ -1998,7 +1998,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.9" + "source": "https://github.com/phpstan/phpstan/tree/1.8.11" }, "funding": [ { @@ -2014,7 +2014,7 @@ "type": "tidelift" } ], - "time": "2022-10-13T13:40:18+00:00" + "time": "2022-10-24T15:45:13+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -2068,21 +2068,21 @@ }, { "name": "phpstan/phpstan-phpunit", - "version": "1.1.1", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84" + "reference": "6b93db7fae6d6f3e81a5b4297f93af6fe4146785" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4a3c437c09075736285d1cabb5c75bf27ed0bc84", - "reference": "4a3c437c09075736285d1cabb5c75bf27ed0bc84", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/6b93db7fae6d6f3e81a5b4297f93af6fe4146785", + "reference": "6b93db7fae6d6f3e81a5b4297f93af6fe4146785", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.5.0" + "phpstan/phpstan": "^1.8.0" }, "conflict": { "phpunit/phpunit": "<7.0" @@ -2114,9 +2114,9 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.1" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.1.3" }, - "time": "2022-04-20T15:24:25+00:00" + "time": "2022-10-24T11:38:17+00:00" }, { "name": "phpstan/phpstan-strict-rules", diff --git a/phpstan/baseline.neon b/phpstan/baseline.neon index f97917a20..1e053293d 100644 --- a/phpstan/baseline.neon +++ b/phpstan/baseline.neon @@ -5836,6 +5836,11 @@ parameters: count: 1 path: ../tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php + - + message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertEmpty\\(\\) with array\\<'0\\.6\\.0'\\|'1\\.0\\.0'\\|'1\\.0\\.x\\-dev'\\|'1\\.1\\.x\\-dev'\\|'9999999\\-dev'\\|'dev\\-feature\\-b'\\|'dev\\-feature/a\\-1\\.0\\-B'\\|'dev\\-master', true\\> and literal\\-string&non\\-falsy\\-string will always evaluate to false\\.$#" + count: 1 + path: ../tests/Composer/Test/Repository/VcsRepositoryTest.php + - message: "#^Only booleans are allowed in a negated boolean, string given\\.$#" count: 1 From 10e757d6b08b27915185ed5ad12cca25932efc8b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 26 Oct 2022 12:27:24 +0200 Subject: [PATCH 2/2] Add extra debug info when running GH Actions and an archive extraction fails, refs #11148 --- src/Composer/Downloader/FileDownloader.php | 13 +++++++++++++ src/Composer/Downloader/ZipDownloader.php | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index b8907553a..6704cb486 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -64,6 +64,15 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface * @internal */ public static $downloadMetadata = []; + /** + * Collects response headers when running on GH Actions + * + * @see https://github.com/composer/composer/issues/11148 + * @var array> + * @private + * @internal + */ + public static $responseHeaders = []; /** * @var array Map of package name to cache key @@ -222,6 +231,10 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface $cacheKey = $url['cacheKey']; FileDownloader::$downloadMetadata[$package->getName()] = @filesize($fileName) ?: $response->getHeader('Content-Length') ?: '?'; + if (Platform::getEnv('GITHUB_ACTIONS') !== false && Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') === false) { + FileDownloader::$responseHeaders[$package->getName()] = $response->getHeaders(); + } + if ($cache && !$cache->isReadOnly()) { $this->lastCacheWrites[$package->getName()] = $cacheKey; $cache->copyFrom($cacheKey, $fileName); diff --git a/src/Composer/Downloader/ZipDownloader.php b/src/Composer/Downloader/ZipDownloader.php index 4a4095e5d..725e6468d 100644 --- a/src/Composer/Downloader/ZipDownloader.php +++ b/src/Composer/Downloader/ZipDownloader.php @@ -151,6 +151,19 @@ class ZipDownloader extends ArchiveDownloader $io->writeError(' '.$processError->getMessage().''); $io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)'); $io->writeError(' Unzip with '.$executable.' command failed, falling back to ZipArchive class'); + + // additional debug data to try to figure out GH actions issues https://github.com/composer/composer/issues/11148 + if (Platform::getEnv('GITHUB_ACTIONS') !== false && Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING') === false) { + $io->writeError(' Additional debug info, please report to https://github.com/composer/composer/issues/11148 if you see this:'); + $io->writeError('File size: '.@filesize($file)); + $io->writeError('File SHA1: '.hash_file('sha1', $file)); + $io->writeError('First 100 bytes (hex): '.bin2hex(substr((string) file_get_contents($file), 0, 100))); + $io->writeError('Last 100 bytes (hex): '.bin2hex(substr((string) file_get_contents($file), -100))); + if (strlen((string) $package->getDistUrl()) > 0) { + $io->writeError('Origin URL: '.$this->processUrl($package, (string) $package->getDistUrl())); + $io->writeError('Response Headers: '.json_encode(FileDownloader::$responseHeaders[$package->getName()] ?? [])); + } + } } return $this->extractWithZipArchive($package, $file, $path);