|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69076 URL parsing throws exception on empty query string
Submitted: 2015-02-19 00:11 UTC Modified: 2015-03-23 09:28 UTC
From: p at wspnr dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.6.5 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 - 3 = ?
Subscribe to this entry?

 [2015-02-19 00:11 UTC] p at wspnr dot com
Any class that parses a URL will throw an exception when a URL with an empty query string (e.g. "") is passed in.

Exception states: Failed to parse query; unexpected byte 0x00 at pos 0 in ''.

I tested http\Url and http\Env\Request.

At least one browser (Google Chrome) produces a URL with an empty query string when a form with no successful controls is submitted. Trying to create a new http\Env\Request object fails in these cases.

Test script:
new \http\Url("");

Expected result:
(no output)

Actual result:
Fatal error: 
Uncaught exception 'http\Exception\BadUrlException' with message 'http\Url::__construct(): Failed to parse query; unexpected byte 0x00 at pos 0 in '''


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-19 00:13 UTC] p at wspnr dot com
I should add that I tested both 2.2.1 and the latest code from Github
 [2015-03-23 09:28 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: mike
 [2015-03-23 09:28 UTC]
PR was merged
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Dec 07 03:05:52 2022 UTC