php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: p at wspnr dot com
New email:
PHP Version: OS:

 

 [2015-02-19 00:11 UTC] p at wspnr dot com
Description:
------------
Any class that parses a URL will throw an exception when a URL with an empty query string (e.g. "http://www.example.com/?") 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("http://www.example.com/?");

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 '''

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] mike@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: mike
 [2015-03-23 09:28 UTC] mike@php.net
PR was merged
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC