Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/197'
Browse files Browse the repository at this point in the history
Close #197
Close #194
Fixes #192
  • Loading branch information
weierophinney committed Sep 7, 2016
2 parents f3eb90b + c1a979e commit 2774665
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ All notable changes to this project will be documented in this file, in reverse
- [#175](https://github.com/zendframework/zend-diactoros/pull/175) updates the
`Request` class to set the `Host` header from the URI host if no header is
already present. (Ensures conformity with PSR-7 specification.)
- [#197](https://github.com/zendframework/zend-diactoros/pull/197) updates the
`Uri` class to ensure that string serialization does not include a colon after
the host name if no port is present in the instance.

## 1.3.5 - 2016-03-17

Expand Down
3 changes: 3 additions & 0 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ private static function createUriString($scheme, $authority, $path, $query, $fra
private function isNonStandardPort($scheme, $host, $port)
{
if (! $scheme) {
if ($host && ! $port) {
return false;
}
return true;
}

Expand Down
7 changes: 6 additions & 1 deletion test/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,6 @@ public function testUtf8Uri()
$this->assertEquals('ουτοπία.δπθ.gr', $uri->getHost());
}


/**
* @dataProvider utf8PathsDataProvider
*/
Expand All @@ -588,4 +587,10 @@ public function utf8PathsDataProvider()
['http://example.com/ουτοπία/', '/ουτοπία/']
];
}

public function testUriDoesNotAppendColonToHostIfPortIsEmpty()
{
$uri = (new Uri())->withHost('google.com');
$this->assertEquals('google.com', (string) $uri);
}
}

0 comments on commit 2774665

Please sign in to comment.