Skip to content

Commit

Permalink
[7.0] Merge changes from 6.5.3 (#2618)
Browse files Browse the repository at this point in the history
* Travis improvements

* Don't use internal functions (#2548)

* [6.5] Install symfony's intl-idn polyfill (#2550)

* Install symfony's intl-idn polyfill

* idn conversion always available

* remove "skipped because of intl"

* PHPStan CI fix

Co-authored-by: Nyholm <tobias.nyholm@gmail.com>

* Prepare release of 6.5.3 (#2613)

* Prepare release of 6.5.3

* Typo

* Updated date

* Updated constant

* Fixed composer.json package order

Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
Co-authored-by: Nyholm <tobias.nyholm@gmail.com>
  • Loading branch information
3 people committed Apr 18, 2020
1 parent 1cdd69a commit ebe6b85
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/static.yml
Expand Up @@ -17,6 +17,8 @@ jobs:

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
env:
REQUIRE_DEV: true
with:
args: analyze --no-progress

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,8 @@

* Avoid the getenv function when unsafe [#2531](https://github.com/guzzle/guzzle/pull/2531)
* Added real client methods [#2529](https://github.com/guzzle/guzzle/pull/2529)
* Avoid functions due to global install conflicts [#2546](https://github.com/guzzle/guzzle/pull/2546)
* Use Symfony intl-idn polyfill [#2550](https://github.com/guzzle/guzzle/pull/2550)

### Removed

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -30,7 +30,8 @@
"ext-json": "*",
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.6.1",
"psr/http-client": "^1.0"
"psr/http-client": "^1.0",
"symfony/polyfill-intl-idn": "^1.11"
},
"provide": {
"psr/http-client-implementation": "1.0"
Expand All @@ -44,7 +45,6 @@
},
"suggest": {
"ext-curl": "Required for CURL handler support",
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"config": {
Expand Down
8 changes: 2 additions & 6 deletions src/Client.php
Expand Up @@ -221,14 +221,10 @@ private function configureDefaults(array $config): void
'http_errors' => true,
'decode_content' => true,
'verify' => true,
'cookies' => false
'cookies' => false,
'idn_conversion' => true,
];

// idn_to_ascii() is a part of ext-intl and might be not available
// Old ICU versions don't have this constant, so we are basically stuck (see https://github.com/guzzle/guzzle/pull/2424
// and https://github.com/guzzle/guzzle/issues/2448 for details)
$defaults['idn_conversion'] = \function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46');

// Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.

// We can only trust the HTTP_PROXY environment variable in a CLI
Expand Down
19 changes: 1 addition & 18 deletions tests/ClientTest.php
Expand Up @@ -708,18 +708,11 @@ public function testIdnSupportDefaultValue()

$config = Helpers::readObjectAttribute($client, 'config');

if (\extension_loaded('intl')) {
self::assertTrue($config['idn_conversion']);
} else {
self::assertFalse($config['idn_conversion']);
}
self::assertTrue($config['idn_conversion']);
}

public function testIdnIsTranslatedToAsciiWhenConversionIsEnabled()
{
if (!\extension_loaded('intl')) {
self::markTestSkipped('intl PHP extension is not loaded');
}
$mockHandler = new MockHandler([new Response()]);
$client = new Client(['handler' => $mockHandler]);

Expand All @@ -746,9 +739,6 @@ public function testIdnStaysTheSameWhenConversionIsDisabled()

public function testExceptionOnInvalidIdn()
{
if (!\extension_loaded('intl')) {
self::markTestSkipped('intl PHP extension is not loaded');
}
$mockHandler = new MockHandler([new Response()]);
$client = new Client(['handler' => $mockHandler]);

Expand All @@ -763,10 +753,6 @@ public function testExceptionOnInvalidIdn()
*/
public function testIdnBaseUri()
{
if (!\extension_loaded('intl')) {
self::markTestSkipped('intl PHP extension is not loaded');
}

$mock = new MockHandler([new Response()]);
$client = new Client([
'handler' => $mock,
Expand All @@ -782,9 +768,6 @@ public function testIdnBaseUri()

public function testIdnWithRedirect()
{
if (!extension_loaded('intl')) {
self::markTestSkipped('intl PHP extension is not loaded');
}
$mockHandler = new MockHandler([
new Response(302, ['Location' => 'http://www.tést.com/whatever']),
new Response()
Expand Down
4 changes: 0 additions & 4 deletions tests/InternalUtilsTest.php
Expand Up @@ -14,10 +14,6 @@ public function testCurrentTime()

public function testIdnConvert()
{
if (!extension_loaded('intl')) {
self::markTestSkipped('intl PHP extension is not loaded');
}

$uri = Psr7\uri_for('https://яндекс.рф/images');
$uri = Utils::idnUriConvert($uri);
self::assertSame('xn--d1acpjx3f.xn--p1ai', $uri->getHost());
Expand Down

0 comments on commit ebe6b85

Please sign in to comment.