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

Commit 2fb22cb

Browse files
committed
Merge branch 'hotfix/258'
Close #258
2 parents 798ee00 + 135dfbd commit 2fb22cb

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ All notable changes to this project will be documented in this file, in reverse
3333
fix for the `PhpInputStream::read()` method to ensure string content that
3434
evaluates as empty (including `0`) is still cached.
3535

36+
- [#258](https://github.com/zendframework/zend-diactoros/pull/258) updates the
37+
`Uri::filterPath()` method to allow parens within a URI path, per [RFC 3986
38+
section 3.3](https://tools.ietf.org/html/rfc3986#section-3.3) (parens are
39+
within the character set "sub-delims").
40+
3641
## 1.4.0 - 2017-04-06
3742

3843
### Added

src/Uri.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ private function filterScheme($scheme)
556556
private function filterPath($path)
557557
{
558558
$path = preg_replace_callback(
559-
'/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/u',
559+
'/(?:[^' . self::CHAR_UNRESERVED . ')(:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/u',
560560
[$this, 'urlEncodeChar'],
561561
$path
562562
);

test/UriTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,4 +617,14 @@ public function testAuthorityIsPrefixedByDoubleSlashIfPresent()
617617
$uri = (new Uri())->withHost('example.com');
618618
$this->assertEquals('//example.com', (string) $uri);
619619
}
620+
621+
public function testReservedCharsInPathUnencoded()
622+
{
623+
$uri = (new Uri())
624+
->withScheme('https')
625+
->withHost('api.linkedin.com')
626+
->withPath('/v1/people/~:(first-name,last-name,email-address,picture-url)');
627+
628+
$this->assertContains('/v1/people/~:(first-name,last-name,email-address,picture-url)', (string) $uri);
629+
}
620630
}

0 commit comments

Comments
 (0)