Bug #64604 [Opn]: parse_url is inconsistent with specified port

From: Date: Sun, 07 Apr 2013 13:16:38 +0000
Subject: Bug #64604 [Opn]: parse_url is inconsistent with specified port
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-178342@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64604&edit=1

 ID:                 64604
 User updated by:    franssen dot roland at gmail dot com
 Reported by:        franssen dot roland at gmail dot com
-Summary:            parse_url without is inconsistent with specified
                     port
+Summary:            parse_url is inconsistent with specified port
 Status:             Open
 Type:               Bug
 Package:            URL related
 Operating System:   Linux
 PHP Version:        5.4.13
 Block user comment: N
 Private report:     N

 New Comment:

typo.


Previous Comments:
------------------------------------------------------------------------
[2013-04-07 13:14:49] franssen dot roland at gmail dot com

Description:
------------
Please see the test script. parse_url() is inconsistent with "//localhost:80/path"

Test script:
---------------
<?php
var_dump(parse_url('//localhost/path'));
var_dump(parse_url('//localhost:80/path'));
var_dump(parse_url('//localhost:/path'));
var_dump(parse_url('http://localhost:80/path'));

Expected result:
----------------
# //localhost/path
array(2) {
  ["host"]=>
  string(9) "localhost"
  ["path"]=>
  string(5) "/path"
}

# //localhost:80/path
array(2) {
  ["host"]=>
  string(9) "localhost"
  ["port"]=>
  int(80)
  ["path"]=>
  string(5) "/path"
}

# //localhost:/path
array(2) {
  ["host"]=>
  string(9) "localhost"
  ["path"]=>
  string(5) "/path"
}

# http://localhost:80/path
array(4) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(9) "localhost"
  ["port"]=>
  int(80)
  ["path"]=>
  string(5) "/path"
}

Actual result:
--------------
# //localhost/path
array(2) {
  ["host"]=>
  string(9) "localhost"
  ["path"]=>
  string(5) "/path"
}

# //localhost:80/path
bool(false)

# //localhost:/path
array(2) {
  ["host"]=>
  string(9) "localhost"
  ["path"]=>
  string(5) "/path"
}

# http://localhost:80/path
array(4) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(9) "localhost"
  ["port"]=>
  int(80)
  ["path"]=>
  string(5) "/path"
}


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64604&edit=1


Thread (8 messages)

« previous php.bugs (#178342) next »