php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36706 $_GET always empty
Submitted: 2006-03-12 19:39 UTC Modified: 2006-03-12 22:11 UTC
From: coshellking at yahoo dot com dot ph Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.1.2 OS: Fedora 3
Private report: No CVE-ID: None
 [2006-03-12 19:39 UTC] coshellking at yahoo dot com dot ph
Description:
------------
Cannot retrieve any value from $_GET eventhough the parameters entered appear correctly in $_SERVER['QUERY_STRING']. 

Reproduce code:
---------------
#!/usr/local/bin/php
<?php
print ("Content-type: text/plain\r\n\r\n");
print ("foo is {$_GET['foo']}\r\n");
print ("GET array is \r\n");
print_r ($_GET);
print ("Request array is \r\n");
print_r ($_REQUEST);
print ("Server query string is \r\n");
print ($_SERVER['QUERY_STRING']);
?>

Executed URL: http://localhost/cgi-bin/test.php?foo=bar

Expected result:
----------------
foo is bar
GET array is 
Array
(
foo => bar
)
Request array is 
Array
(
foo => bar
)
Server query string is 
foo=bar


Actual result:
--------------
foo is 
GET array is 
Array
(
)
Request array is 
Array
(
)
Server query string is 
foo=bar


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-12 22:11 UTC] mike@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

QUERY_STRING is just an environment variable, thus $_SERVER contains it.

The CLI SAPI does not attempt to fill the request superglobals.

Use parse_str($_SERVER['QUERY_STRING'], $_GET), but I strongly discourage from abusing the CLI SAPI as CGI SAPI.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC