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

Commit eabbc66

Browse files
committed
Merge pull request #197 from samsonasik/fix/192
Alternate fixes #192 Conflicts: test/UriTest.php
2 parents f3eb90b + e022b52 commit eabbc66

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Uri.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,9 @@ private static function createUriString($scheme, $authority, $path, $query, $fra
507507
private function isNonStandardPort($scheme, $host, $port)
508508
{
509509
if (! $scheme) {
510+
if ($host && ! $port) {
511+
return false;
512+
}
510513
return true;
511514
}
512515

test/UriTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ public function testUtf8Uri()
569569
$this->assertEquals('ουτοπία.δπθ.gr', $uri->getHost());
570570
}
571571

572-
573572
/**
574573
* @dataProvider utf8PathsDataProvider
575574
*/
@@ -588,4 +587,10 @@ public function utf8PathsDataProvider()
588587
['http://example.com/ουτοπία/', '/ουτοπία/']
589588
];
590589
}
590+
591+
public function testUriDoesNotAppendColonToHostIfPortIsEmpty()
592+
{
593+
$uri = (new Uri())->withHost('google.com');
594+
$this->assertEquals('google.com', (string) $uri);
595+
}
591596
}

0 commit comments

Comments
 (0)