Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change minimal port number to 0 (unix socket) #270

Merged
merged 1 commit into from May 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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