#43411 [Opn->Bgs]: parse_url with relative URLs contained http:// in parameters

From: Date: Mon, 26 Nov 2007 12:49:19 +0000
Subject: #43411 [Opn->Bgs]: parse_url with relative URLs contained http:// in parameters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120084@lists.php.net to get a copy of this message
ID: 43411 Updated by: jani@php.net Reported By: php at koterov dot ru -Status: Open +Status: Bogus Bug Type: URL related PHP Version: 5.2.5 New Comment: There is quite clear note in manual for parse_url(): "Note: This function doesn't work with relative URLs." Previous Comments: ------------------------------------------------------------------------ [2007-11-26 12:34:59] php at koterov dot ru Description: ------------ When I pass a relative URL to parse_url and it contains something like "http://xxx" in QUERY_STRING parameters, parse_url reports that the URL is broken. So it is not always safe to call parse_url($_SERVER['REQUEST_URI']) I think the solution should be: if an URL is relative (started with '/'), do not report a warning when its arguments contain ":". Possibly you will say "won't fix" and "URL is not RFC-complaint", but this argument is not relevant when I call parse_url($_SERVER['REQUEST_URI']) (it may be hand-made and non-RFC complaint). Reproduce code: --------------- print_r(parse_url('/test/?retpath=http://xxx')); Expected result: ---------------- ok Actual result: -------------- Warning: parse_url(/test/?retpath=http://xxx): Unable to parse URL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43411&edit=1

« previous php.bugs (#120084) next »