Skip to content

Commit

Permalink
Merge pull request #42 from mirago/fix-41
Browse files Browse the repository at this point in the history
Fix undefined port error in parse function, when the port was not found.
  • Loading branch information
evert committed Jul 8, 2019
2 parents 5cd3417 + 46cd057 commit 1381865
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ function ($matches) {
if ($matches['host']) {
$result['host'] = $matches['host'];
}
if ($matches['port']) {
if (isset($matches['port'])) {
$result['port'] = (int) $matches['port'];
}
if (isset($matches['path'])) {
Expand Down
24 changes: 24 additions & 0 deletions tests/ParseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,30 @@ public function parseData()
'fragment' => 'foo',
],
],
[
'https://',
[
'scheme' => 'https',
'host' => null,
'path' => null,
'port' => null,
'user' => null,
'query' => null,
'fragment' => null,
],
],
[
'https://test',
[
'scheme' => 'https',
'host' => 'test',
'path' => null,
'port' => null,
'user' => null,
'query' => null,
'fragment' => null,
],
],
];
}
}

0 comments on commit 1381865

Please sign in to comment.