Skip to content

Commit f056b4e

Browse files
minor symfony#25270 Fail as early and noisily as possible (greg0ire)
This PR was merged into the 3.3 branch. Discussion ---------- Fail as early and noisily as possible | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n / a | License | MIT An alternative would be to use a custom error handler Commits ------- 3bdeda0 Fail as early and noisily as possible
2 parents 61e1f57 + 3bdeda0 commit f056b4e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
5151
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION"));
5252
}
5353
if (extension_loaded('openssl') && ini_get('allow_url_fopen') && !isset($_SERVER['http_proxy']) && !isset($_SERVER['https_proxy'])) {
54-
stream_copy_to_stream(fopen("https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip", 'rb'), fopen("$PHPUNIT_VERSION.zip", 'wb'));
54+
$remoteZip = "https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip";
55+
$remoteZipStream = @fopen($remoteZip, 'rb');
56+
if (!$remoteZipStream) {
57+
throw new \RuntimeException("Could not find $remoteZip");
58+
}
59+
stream_copy_to_stream($remoteZipStream, fopen("$PHPUNIT_VERSION.zip", 'wb'));
5560
} else {
5661
@unlink("$PHPUNIT_VERSION.zip");
5762
passthru("wget https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip");

0 commit comments

Comments
 (0)