[PHP-BUG] Bug #52803 [NEW]: parse_url can't handle urls without a scheme.

2010-09-09 Thread leif at flattr dot com
From: 
Operating system: osx and debian linux
PHP version:  5.3.3
Package:  *General Issues
Bug Type: Bug
Bug description:parse_url can't handle urls without a scheme.

Description:

parse_url will falsely use the hostname as path if url doesn't include the
scheme part.







Test script:
---
php > echo var_dump(parse_url('hejhopp.com/'));



Expected result:

array(1) {

  ["host"]=>

  string(11) "hejhopp.com"

  ["path"]=>

  string(1) "/"

}

Actual result:
--
array(1) {

  ["path"]=>

  string(12) "hejhopp.com/"

}

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52803&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52803&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52803&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=52803&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52803&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52803&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52803&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=52803&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=52803&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=52803&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=52803&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=52803&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=52803&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=52803&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52803&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=52803&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=52803&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=52803&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=52803&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=52803&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=52803&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=52803&r=mysqlcfg



Bug #52803 [Bgs]: parse_url can't handle urls without a scheme.

2010-09-09 Thread leif at flattr dot com
Edit report at http://bugs.php.net/bug.php?id=52803&edit=1

 ID: 52803
 User updated by:leif at flattr dot com
 Reported by:leif at flattr dot com
 Summary:parse_url can't handle urls without a scheme.
 Status: Bogus
 Type:   Bug
 Package:*General Issues
 Operating System:   osx and debian linux
 PHP Version:5.3.3
 Block user comment: N

 New Comment:

Yes the manual suggests otherwise.



"Partial URLs are also accepted, parse_url() tries its best to parse
them correctly." - php manual



I would expect parse_url to try to parse from left to right starting
with scheme and then moving on to host.


Previous Comments:

[2010-09-09 18:05:22] scott...@php.net

The function is designed to work with a fully qualified URL, does the
manual 

suggest otherwise?


[2010-09-09 18:02:23] leif at flattr dot com

Description:

parse_url will falsely use the hostname as path if url doesn't include
the scheme part.







Test script:
---
php > echo var_dump(parse_url('hejhopp.com/'));



Expected result:

array(1) {

  ["host"]=>

  string(11) "hejhopp.com"

  ["path"]=>

  string(1) "/"

}

Actual result:
--
array(1) {

  ["path"]=>

  string(12) "hejhopp.com/"

}






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