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

Commit

Permalink
Merge branch 'hotfix/17'
Browse files Browse the repository at this point in the history
Close #17
Fixes #13
  • Loading branch information
weierophinney committed Apr 10, 2018
2 parents 43a82de + c43bce6 commit 9302265
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#17](https://github.com/zendframework/zend-uri/pull/17) updates the path
encoding algorithm to allow `(` and `)` characters as path characters (per
the RFC-3986, these are valid sub-delimiters allowed within a path).

## 2.5.2 - 2016-02-17

Expand Down
2 changes: 1 addition & 1 deletion src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ public static function encodePath($path)
));
}

$regex = '/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/';
$regex = '/(?:[^' . self::CHAR_UNRESERVED . ')(:@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/';
$escaper = static::getEscaper();
$replace = function ($match) use ($escaper) {
return $escaper->escapeUrl($match[0]);
Expand Down
13 changes: 13 additions & 0 deletions test/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1360,4 +1360,17 @@ public function testParseTwice()
$this->assertNull($uri->getQuery());
$this->assertNull($uri->getFragment());
}

public function testReservedCharsInPathUnencoded()
{
$uri = new Uri();
$uri->setScheme('https');
$uri->setHost('api.linkedin.com');
$uri->setPath('/v1/people/~:(first-name,last-name,email-address,picture-url)');

$this->assertSame(
'https://api.linkedin.com/v1/people/~:(first-name,last-name,email-address,picture-url)',
$uri->toString()
);
}
}

0 comments on commit 9302265

Please sign in to comment.