Bug #71960 [Opn]: parse_url() return empty query, empty fragment

From: Date: Mon, 04 Apr 2016 20:54:45 +0000
Subject: Bug #71960 [Opn]: parse_url() return empty query, empty fragment
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200352@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71960&edit=1 ID: 71960 User updated by: whatchildisthis at gmail dot com Reported by: whatchildisthis at gmail dot com Summary: parse_url() return empty query, empty fragment Status: Open Type: Bug Package: URL related PHP Version: 7.0.5 Block user comment: N Private report: N New Comment: (Edit: Corrected var_export() in test script, not print_r()) Description: ------------ parse_url() returns an index for a 0-length username and 0-length password, but not for a 0-length query or fragment. (http://www.faqs.org/rfcs/rfc3986.html) Test script: --------------- <?php var_export(parse_url("http://example.com"); var_export(parse_url("http://:@example.com?#"); ?> Expected result: ---------------- array ( 'scheme' => 'http', 'host' => 'example.com', )array ( 'scheme' => 'http', 'host' => 'example.com', 'user' => '', 'pass' => '', 'query' => '', 'fragment' => '', ) Actual result: -------------- array ( 'scheme' => 'http', 'host' => 'example.com', )array ( 'scheme' => 'http', 'host' => 'example.com', 'user' => '', 'pass' => '', ) Previous Comments: ------------------------------------------------------------------------ [2016-04-04 20:51:55] whatchildisthis at gmail dot com Description: ------------ parse_url() returns an index for a 0-length username and 0-length password, but not for a 0-length query or fragment. (http://www.faqs.org/rfcs/rfc3986.html) Test script: --------------- <?php print_r(parse_url("http://example.com"); print_r(parse_url("http://:@example.com?#"); ?> Expected result: ---------------- array ( 'scheme' => 'http', 'host' => 'example.com', )array ( 'scheme' => 'http', 'host' => 'example.com', 'user' => '', 'pass' => '', 'query' => '', 'fragment' => '', ) Actual result: -------------- array ( 'scheme' => 'http', 'host' => 'example.com', )array ( 'scheme' => 'http', 'host' => 'example.com', 'user' => '', 'pass' => '', ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71960&edit=1

« previous php.bugs (#200352) next »