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

Host contain a colon when port is empty #33

Closed
linkuha opened this issue Aug 16, 2019 · 0 comments
Closed

Host contain a colon when port is empty #33

linkuha opened this issue Aug 16, 2019 · 0 comments
Labels
Milestone

Comments

@linkuha
Copy link

linkuha commented Aug 16, 2019

i think in this case we have technically valid url, parse_url function also correct parses host

Example:

$source_uri = 'http://example.com:/';
echo 'parse_url: ';
var_dump(parse_url($source_uri));

$uri = new \Zend\Uri\Http($source_uri);
$tmp = [
    'scheme' => $uri->getScheme(),
    'user' => $uri->getUserInfo(),
    'host' => $uri->getHost(),
    'port' => $uri->getPort(),
    'path' => $uri->getPath(),
    'query' => $uri->getQuery(),
    'fragment' => $uri->getFragment(),
];
echo "\nzend-uri: ";
var_dump($tmp);

result output:

parse_url:
array (size=3)
      'scheme' => string 'http' (length=4)
      'host' => string 'example.com' (length=11)
      'path' => string '/' (length=1)
zend-uri:
array (size=7)
      'scheme' => string 'http' (length=4)
      'user' => null
      'host' => string 'example.com:' (length=12)
      'port' => int 80
      'path' => string '/' (length=1)
      'query' => null
      'fragment' => null
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants