Skip to content

Commit

Permalink
Bug fix Fragment::getUriComponent #31
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Jan 18, 2016
1 parent a851a6b commit 667d64c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All Notable changes to `League\Uri` will be documented in this file
- Improve Uri Component modification [issue #29](https://github.com/thephpleague/uri/issues/29)
- Improve Path encoding/decoding [issue #28](https://github.com/thephpleague/uri/issues/28)
- Improve lowercase transformation in hostname [issue #27](https://github.com/thephpleague/uri/issues/27)
- Bug when the fragment value is wrongly evaluated as empty [issue #31](https://github.com/thephpleague/uri/issues/31)

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Fragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Fragment extends AbstractComponent implements FragmentInterface
public function getUriComponent()
{
$component = $this->__toString();
if (!empty($component)) {
if ('' !== $component) {
$component = FragmentInterface::DELIMITER.$component;
}

Expand Down
3 changes: 2 additions & 1 deletion test/Components/FragmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function validFragment()
return [
'null' => [null, ''],
'empty' => ['', ''],
'evaluate empty' => ['0', '#0'],
'hash' => ['#', '#%23'],
'toofan' => ['toofan', '#toofan'],
'notencoded' => ["azAZ0-9/?-._~!$&'()*+,;=:@", '#azAZ0-9/?-._~!$&\'()*+,;=:@'],
Expand All @@ -50,7 +51,7 @@ public function failedConstructor()
'bool' => [true],
'Std Class' => [(object) 'foo'],
'float' => [1.2],
'array' => [['foo']],
'array' => [['foo']],
];
}
}

0 comments on commit 667d64c

Please sign in to comment.