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

Commit

Permalink
Fix error when accessing a single attribute before any have been added.
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfelt committed May 22, 2015
1 parent f77199c commit 611386c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ServerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ServerRequest implements ServerRequestInterface
/**
* @var array
*/
private $attributes;
private $attributes = [];

/**
* @var array
Expand Down
4 changes: 4 additions & 0 deletions test/ServerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public function testAttributesAreEmptyByDefault()
$this->assertEmpty($this->request->getAttributes());
}

public function testSingleAttributesWhenEmptyByDefault()
{
$this->assertEmpty($this->request->getAttribute('does-not-exist'));
}
/**
* @depends testAttributesAreEmptyByDefault
*/
Expand Down

0 comments on commit 611386c

Please sign in to comment.