From:             franssen dot roland at gmail dot com
Operating system: Linux
PHP version:      5.4.13
Package:          URL related
Bug Type:         Bug
Bug description:parse_url without is inconsistent with specified port

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 bug report at https://bugs.php.net/bug.php?id=64604&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64604&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64604&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64604&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64604&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64604&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64604&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64604&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64604&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64604&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64604&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64604&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64604&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64604&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64604&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64604&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64604&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64604&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64604&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64604&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64604&r=mysqlcfg

Reply via email to