Skip to content

Commit

Permalink
Change minimal port number to 0 (unix socket) (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tracerneo authored and Nyholm committed May 26, 2019
1 parent a346647 commit dd1ba1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Uri.php
Expand Up @@ -628,9 +628,9 @@ private function filterPort($port)
}

$port = (int) $port;
if (1 > $port || 0xffff < $port) {
if (0 > $port || 0xffff < $port) {
throw new \InvalidArgumentException(
sprintf('Invalid port: %d. Must be between 1 and 65535', $port)
sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
);
}

Expand Down
8 changes: 4 additions & 4 deletions tests/UriTest.php
Expand Up @@ -117,7 +117,7 @@ public function getInvalidUris()

/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Invalid port: 100000. Must be between 1 and 65535
* @expectedExceptionMessage Invalid port: 100000. Must be between 0 and 65535
*/
public function testPortMustBeValid()
{
Expand All @@ -126,11 +126,11 @@ public function testPortMustBeValid()

/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Invalid port: 0. Must be between 1 and 65535
* @expectedExceptionMessage Invalid port: -1. Must be between 0 and 65535
*/
public function testWithPortCannotBeZero()
public function testWithPortCannotBeNegative()
{
(new Uri())->withPort(0);
(new Uri())->withPort(-1);
}

/**
Expand Down

0 comments on commit dd1ba1d

Please sign in to comment.