php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58008 HttpQueryString doesn't get value of $_SERVER['QUERY_STRING'] when set in php
Submitted: 2008-01-14 11:58 UTC Modified: 2008-01-15 02:15 UTC
From: mattsch at gmail dot com Assigned: mike (profile)
Status: Not a bug Package: pecl_http (PECL)
PHP Version: 5.2.1 OS: Gentoo 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: mattsch at gmail dot com
New email:
PHP Version: OS:

 

 [2008-01-14 11:58 UTC] mattsch at gmail dot com
Description:
------------
If $_SERVER['QUERY_STRING'] is set in php before making the call to create a new HttpQueryString object and that object is set with the global parameter to true, it does not get the value of that variable.

Reproduce code:
---------------
$_SERVER['QUERY_STRING'] = 'foo=bar';
$query = new HttpQueryString(true, array('foo2' => 'bar2'));
var_dump($query);

Expected result:
----------------
object(HttpQueryString)#1 (2) {
  ["queryArray:private"]=>
  &array(2) {
    ["foo"]=>
    string(4) "bar"
    ["foo2"]=>
    string(4) "bar2"
  }
  ["queryString:private"]=>
  &string(9) "foo=bar&foo2=bar2"
}

Actual result:
--------------
object(HttpQueryString)#1 (2) {
  ["queryArray:private"]=>
  &array(1) {
    ["foo2"]=>
    string(4) "bar2"
  }
  ["queryString:private"]=>
  &string(9) "foo2=bar2"
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-15 02:15 UTC] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug.

pecl_http uses sapi_getenv() instead of accessing the $_SERVER array, so this is expected behaviour.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC