#36706 [Opn->Bgs]: $_GET always empty
| From: | mike@php.net | Date: | Sun, 12 Mar 2006 21:11:20 +0000 |
| Subject: | #36706 [Opn->Bgs]: $_GET always empty | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-94230@lists.php.net to get a copy of this message | ||
ID: 36706
Updated by: mike@php.net
Reported By: coshellking at yahoo dot com dot ph
-Status: Open
+Status: Bogus
Bug Type: CGI related
Operating System: Fedora 3
PHP Version: 5.1.2
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2006-03-12 19:39:11] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36706&edit=1