Bug #62844 [Com]: parse_url() does not recognize //

From: Date: Tue, 22 Oct 2013 16:44:38 +0000
Subject: Bug #62844 [Com]: parse_url() does not recognize //
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182387@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62844&edit=1

 ID:                 62844
 Comment by:         hanskrentel at yahoo dot de
 Reported by:        phpqa at sebastianmendel dot de
 Summary:            parse_url() does not recognize //
 Status:             Closed
 Type:               Bug
 Package:            URL related
 Operating System:   Linux
 PHP Version:        5.4.6
 Assigned To:        stas
 Block user comment: N
 Private report:     N

 New Comment:

There is a problem when having @ before the (empty) hostname, the "try best as possible"
is gone then since 5.4.7 (when this 62844 fix was introduced):

echo print_r(parse_url('//site@/path/to/file.css?query'));

not parsing any path nor other parts any longer - it did before. the fix has somewhat broken this.

http://3v4l.org/mhsO7

Also why do you introduce a backwards incompatible change in a minor revision?


Previous Comments:
------------------------------------------------------------------------
[2012-08-20 05:21:48] stas@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2012-08-19 23:33:27] ajf at ajf dot me

Added patch and made pull request: https://github.com/php/php-src/pull/169

------------------------------------------------------------------------
[2012-08-17 09:59:15] phpqa at sebastianmendel dot de

even if doc says "This function doesn't work with relative URLs." it also says: 
"Partial URLs are also accepted, parse_url() tries its best to parse them 
correctly."

and it parses relative URLs like /path/file.html?var=1&foo=bar#123 correctly

------------------------------------------------------------------------
[2012-08-17 09:22:03] phpqa at sebastianmendel dot de

Description:
------------
parse_url() does not recognize '//' as scheme to host separator and therefor does 
not recognize exemple.org as host in URL "//example.org"

Test script:
---------------
var_dump(parse_url('//example.org'));


Expected result:
----------------
array(1) {
  'host' =>
  string(11) "example.org"
}


Actual result:
--------------
array(1) {
  'path' =>
  string(14) "//example.org"
}




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



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


Thread (6 messages)

« previous php.bugs (#182387) next »