Bug #71646 [Opn->Nab]: parse_url fails to parse relative url with port-like string in url

From: Date: Wed, 21 Apr 2021 12:21:31 +0000
Subject: Bug #71646 [Opn->Nab]: parse_url fails to parse relative url with port-like string in url
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233539@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71646&edit=1 ID: 71646 Updated by: cmb@php.net Reported by: jona at mode dot com Summary: parse_url fails to parse relative url with port-like string in url -Status: Open +Status: Not a bug Type: Bug Package: URL related Operating System: linux PHP Version: 5.6.18 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > This bug is for a relative URL. Bug 70942 is a schema-less > absolute URL. Right, but both issues have the same root cause, namely that the colon is recognized as port delimiter, and as such the URL is recognized as invalid. It is already documented[1] that | Partial URLs are also accepted, parse_url() tries its best to | parse them correctly. So this is not a bug. If you feel that parse_url() should be improved wrt. partial URLs, please pursue the RFC process[2]. [1] <https://www.php.net/parse_url> [2] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2017-08-06 21:29:12] requinix@php.net Related To: Bug #75041 ------------------------------------------------------------------------ [2016-09-02 08:43:31] bugs dot php dot net at chsc dot dk Related To: Bug #55511 ------------------------------------------------------------------------ [2016-02-23 14:55:33] jona at mode dot com This bug is for a relative URL. Bug 70942 is a schema-less absolute URL. ------------------------------------------------------------------------ [2016-02-23 12:04:47] cmb@php.net This appears to be a duplicate of bug #70942. ------------------------------------------------------------------------ [2016-02-22 18:28:30] jona at mode dot com Description: ------------ When a relative URL without a scheme and port, but with a port-like string (e.g. /example.com/foo:1234) is passed to parse_url(), it fails to parse the URL (returning false). Test script: --------------- var_dump(parse_url("/foo/bar:1")); Expected result: ---------------- array(1) { ["path"]=> string(10) "/foo/bar:1" } Actual result: -------------- false ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71646&edit=1

« previous php.bugs (#233539) next »