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

From: Date: Thu, 09 Sep 2010 16:08:48 +0000
Subject: Bug #52803 [Bgs]: parse_url can't handle urls without a scheme.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154215@lists.php.net to get a copy of this message
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] scottmac@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

« previous php.bugs (#154215) next »