Silently fail unblock
If the user unblocks and address that was not blocked, silently fail
This commit is contained in:
parent
550b32e1e7
commit
852e5777e3
@ -34,7 +34,9 @@ class IpBlackListComponent implements MessageComponentInterface {
|
||||
* @return IpBlackList
|
||||
*/
|
||||
public function unblockAddress($ip) {
|
||||
unset($this->_blacklist[$this->filterAddress($ip)]);
|
||||
if (isset($this->_blacklist[$this->filterAddress($ip)])) {
|
||||
unset($this->_blacklist[$this->filterAddress($ip)]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -84,4 +84,8 @@ class IpBlackListComponentTest extends \PHPUnit_Framework_TestCase {
|
||||
public function testFilterAddress($expected, $input) {
|
||||
$this->assertEquals($expected, $this->_comp->filterAddress($input));
|
||||
}
|
||||
|
||||
public function testUnblockingSilentlyFails() {
|
||||
$this->assertInstanceOf('\\Ratchet\\Component\\Server\\IpBlackListComponent', $this->_comp->unblockAddress('localhost'));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user