Skip to content

Commit

Permalink
bug #20862 Allow simple-phpunit to be used with an HTTP proxy (Cydonia7)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.2 branch.

Discussion
----------

Allow simple-phpunit to be used with an HTTP proxy

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | no

The title pretty much sums it up. I had to use the script behind a proxy and it did not work well so here is a little fix to take the `http_proxy` environment variable into account when downloading with fopen.

I don't think there needs to be a doc PR associated since this feature should be transparent for the end-user.

Commits
-------

921b646 Allow simple-phpunit to be used with an HTTP proxy
  • Loading branch information
fabpot committed Dec 13, 2016
2 parents 8e19e2c + 921b646 commit 126c7ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
Expand Up @@ -37,7 +37,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
if (file_exists("phpunit-$PHPUNIT_VERSION")) {
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? '(del /S /F /Q %s & rmdir %1$s) >nul': 'rm -rf %s', "phpunit-$PHPUNIT_VERSION"));
}
if (extension_loaded('openssl') && ini_get('allow_url_fopen')) {
if (extension_loaded('openssl') && ini_get('allow_url_fopen') && !isset($_SERVER['http_proxy']) && !isset($_SERVER['https_proxy'])) {
stream_copy_to_stream(fopen("https://github.com/sebastianbergmann/phpunit/archive/$PHPUNIT_VERSION.zip", 'rb'), fopen("$PHPUNIT_VERSION.zip", 'wb'));
} else {
@unlink("$PHPUNIT_VERSION.zip");
Expand Down

0 comments on commit 126c7ff

Please sign in to comment.