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

Pull Requests

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: Sat Dec 21 17:01:58 2024 UTC