Bug #71960 [Asn->Fbk]: parse_url() return empty query, empty fragment

From: Date: Fri, 15 Apr 2016 14:22:44 +0000
Subject: Bug #71960 [Asn->Fbk]: parse_url() return empty query, empty fragment
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200573@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 Updated by: jhdxr@php.net Reported by: whatchildisthis at gmail dot com Summary: parse_url() return empty query, empty fragment -Status: Assigned +Status: Feedback Type: Bug Package: URL related PHP Version: 7.0.5 Assigned To: jhdxr Block user comment: N Private report: N New Comment: There are some test cases in parse_url_basic_007.phpt proving that the following cases are worked as expected: 1. http://www.php.net/? ==> no query 2. http://www.php.net:80/?# ==> no query and no fragment and there is nothing indicating query string or frament can be empty(0-length), while the section of authority says it can be empty clearly. So could you give more info to prove that we should phrase empty query or empty fragment? Previous Comments: ------------------------------------------------------------------------ [2016-04-04 20:54:44] whatchildisthis at gmail dot com (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' => '', ) ------------------------------------------------------------------------ [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 (#200573) next »