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

Commit

Permalink
Merging develop to master in preparation for 2.7.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Feb 27, 2019
2 parents 7e2a89d + df9b1e7 commit b2785cd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 2.6.3 - TBD
## 2.7.0 - 2019-02-27

### Added

- Nothing.

### Changed

- Nothing.
- [#29](https://github.com/zendframework/zend-uri/pull/29) changes the behavior of `getHost()`: it will now always return a lowercase
- representation. This is in accord with
- [IETF 3986 Section 3.2.2](https://tools.ietf.org/html/rfc3986#section-3.2.2).

### Deprecated

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.6.x-dev",
"dev-develop": "2.7.x-dev"
"dev-master": "2.7.x-dev",
"dev-develop": "2.8.x-dev"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions docs/book/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ $scheme = $uri->getHost(); // "example.com"

The `getHost()` method returns only the host part of the URI object.

> ### Host is case insensitive
>
> Per [IETF 3986 Section 3.2.2](https://tools.ietf.org/html/rfc3986#section-3.2.2),
> the host segment of a URL is considered case insensitive. As such, starting in
> version 2.7.0, we now cast the hostname to lowercase, and `getHost()` will
> always return a lowercase representation.
### Getting the port of the URI

The port of the URI is the optional part of the URI that follows the host-part
Expand Down
4 changes: 4 additions & 0 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@ public function setHost($host)
), Exception\InvalidUriPartException::INVALID_HOSTNAME);
}

if ($host !== null) {
$host = strtolower($host);
}

$this->host = $host;
return $this;
}
Expand Down
10 changes: 5 additions & 5 deletions test/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function testSetGetValidHost($host)
{
$uri = new Uri;
$uri->setHost($host);
$this->assertEquals($host, $uri->getHost());
$this->assertEquals(strtolower($host), $uri->getHost());
}

/**
Expand Down Expand Up @@ -821,12 +821,12 @@ public function validUriStringProvider()
['mailto:bob@example.com'],
['bob@example.com'],
['http://a_.!~*\'(-)n0123Di%25%26:pass;:&=+$,word@www.zend.com'],
['http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html'],
['http://[1080::8:800:200C:417A]/foo'],
['http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]:80/index.html'],
['http://[1080::8:800:200c:417a]/foo'],
['http://[::192.9.5.5]/ipng'],
['http://[::FFFF:129.144.52.38]:80/index.html'],
['http://[::ffff:129.144.52.38]:80/index.html'],
['http://[2620:0:1cfe:face:b00c::3]/'],
['http://[2010:836B:4179::836B:4179]'],
['http://[2010:836b:4179::836b:4179]'],
['http'],
['www.example.org:80'],
['www.example.org'],
Expand Down

0 comments on commit b2785cd

Please sign in to comment.