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

Commit 17556d2

Browse files
committed
Merge branch 'hotfix/151'
Close #151 Fixes #93
2 parents d8d8ad2 + 84cf4dc commit 17556d2

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ All notable changes to this project will be documented in this file, in reverse
3131
- [#148](https://github.com/zendframework/zend-diactoros/pull/148) fixes several
3232
stream operations to ensure they raise exceptions when the internal pointer
3333
is at an invalid position.
34+
- [#151](https://github.com/zendframework/zend-diactoros/pull/151) ensures
35+
URI fragments are properly encoded.
3436

3537
## 1.3.3 - 2016-01-04
3638

src/Uri.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ private function splitQueryValue($value)
627627
private function filterFragment($fragment)
628628
{
629629
if (! empty($fragment) && strpos($fragment, '#') === 0) {
630-
$fragment = substr($fragment, 1);
630+
$fragment = '%23' . substr($fragment, 1);
631631
}
632632

633633
return $this->filterQueryOrFragment($fragment);

test/UriTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,11 @@ public function testStripsQueryPrefixIfPresent()
388388
$this->assertEquals('foo=bar', $new->getQuery());
389389
}
390390

391-
public function testStripsFragmentPrefixIfPresent()
391+
public function testEncodeFragmentPrefixIfPresent()
392392
{
393393
$uri = new Uri('http://example.com');
394394
$new = $uri->withFragment('#/foo/bar');
395-
$this->assertEquals('/foo/bar', $new->getFragment());
395+
$this->assertEquals('%23/foo/bar', $new->getFragment());
396396
}
397397

398398
public function standardSchemePortCombinations()

0 commit comments

Comments
 (0)