Bug #70942 [Asn->Opn]: parse_url for url without port and scheme, but with port-like string in url

From: Date: Tue, 24 Oct 2017 07:15:19 +0000
Subject: Bug #70942 [Asn->Opn]: parse_url for url without port and scheme, but with port-like string in url
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212052@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70942&edit=1

 ID:                 70942
 Updated by:         kalle@php.net
 Reported by:        taco at procurios dot nl
 Summary:            parse_url for url without port and scheme, but with
                     port-like string in url
-Status:             Assigned
+Status:             Open
 Type:               Bug
 Package:            URL related
 Operating System:   linux
 PHP Version:        5.6.15
-Assigned To:        datibbaw
+Assigned To:        
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2016-08-17 09:50:24] driezasson at icloud dot com

Even a URL with a port, but without a scheme doesn’t get parsed. E.g.:
'//example.com:80/'.

Expected result:
['host' => 'example.com', 'port' => 80]

Actual result:
false

------------------------------------------------------------------------
[2016-02-23 14:55:34] jona at mode dot com

Related To: Bug #71646

------------------------------------------------------------------------
[2016-02-23 12:04:47] cmb@php.net

Related To: Bug #71646

------------------------------------------------------------------------
[2015-11-20 14:46:26] laruence@php.net

@datibbaw, could you have a look into this one? thanks

------------------------------------------------------------------------
[2015-11-20 09:25:00] taco at procurios dot nl

The commit I've mentioned does not introduce this issue. Afaik, this issue is much older, but
was 'masked' by bug #68917. After this bug was fixed
(https://github.com/php/php-src/commit/d7fb52ea20aba5c9ef53dfa57af3b62717c9e9e5#diff-8c81b7e6f1bafce737814315214a5f23)
parse_url no longer returned false for URLs without a scheme, but with a colon.

parse_url assumes that the colon character can only be used for the port subcomponent of a URI, but
it is allowed in the path component too (see: https://tools.ietf.org/html/rfc3986#section-3.3).
The parser should look for a colon character, but not after the first single slash in a URL,
anything after that slash is part of the path, query or fragment.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=70942


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


Thread (6 messages)

« previous php.bugs (#212052) next »