php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10804 No HTTP_POST_VARS
Submitted: 2001-05-11 04:17 UTC Modified: 2002-05-24 20:34 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: hectorp at buckfoodsvc dot com Assigned:
Status: Not a bug Package: Other web server
PHP Version: 4.0.5 OS: Windows 2000
Private report: No CVE-ID:
 [2001-05-11 04:17 UTC] hectorp at buckfoodsvc dot com
PHP 4.0.5 and 4.0.4pl1 (tried the latter as a fallback) downloaded as binaries from your php.net site, running Xitami.  Also tried on a Windows ME machine and got the same results, which are:

POSTing from a form does not result in the $HTTP_POST_VARS array being created.  It also doesn't create the global versions of these variables (with register_globals on or off).  However, it _does_ create appropriate entries in $HTTP_ENV_VARS['FORM_*'] and $HTTP_SERVER_VARS['FORM_*'].  Additionally, $HTTP_COOKIE_VARS show up fine (unrelated, just FYI).

I used this code to "emulate" (badly) the HTTP_POST_VARS variables, just to be sure that was really the problem:

if(count($HTTP_POST_VARS) < 2) { // test always succeeds
  reset($HTTP_ENV_VARS);         // is set, but is 0 size
  while(list($k,$v) = each($HTTP_ENV_VARS)) {
    if(!strncmp($k,"FORM_",5)) {
      $g = strtolower(substr($k,5));
      $HTTP_POST_VARS[$g] = $v;  // create fake array var
      $$g = $v;                  // create fake global var
    }
  }
}

I tried several scripts from the internet (Phorum, etc.) and had the same problem with all, whenever a form POSTed, on both machines using both versions of PHP.  Even a form with only a simple submit button fails without the above hack.  This is bizaare.

Here are some typical results from phpinfo() after a POST:

This is from the Environment section:

QUERY_METHOD POST 
REQUEST_METHOD POST 
 ...
FORM_SET Login 
FORM_AUTHKEY   
FORM_AUTHPASS 22222222 
FORM_AUTHUSER Myadmin23 
FORM_REFERERURL http://forum.hectorplasmic.com/frontpage.php 

This is from the PHP Variables section:

HTTP_SERVER_VARS["QUERY_METHOD"] POST 
HTTP_SERVER_VARS["REQUEST_METHOD"] POST 
 ...
HTTP_SERVER_VARS["FORM_SET"] Login 
HTTP_SERVER_VARS["FORM_AUTHKEY"]  
HTTP_SERVER_VARS["FORM_AUTHPASS"] 22222222 
HTTP_SERVER_VARS["FORM_AUTHUSER"] Myadmin23 
HTTP_SERVER_VARS["FORM_REFERERURL"] http://forum.hectorplasmic.com/frontpage.php 

So is this:

HTTP_ENV_VARS["QUERY_METHOD"] POST 
HTTP_ENV_VARS["REQUEST_METHOD"] POST 
HTTP_ENV_VARS["GATEWAY_INTERFACE"] CGI/1.1 
HTTP_ENV_VARS["SERVER_SECURITY"] - 
HTTP_ENV_VARS["SERVER_PROTOCOL"] HTTP/1.1 
HTTP_ENV_VARS["SERVER_PORT"] 80 
 ...
HTTP_ENV_VARS["SERVER_VERSION"] 2.5b1 
HTTP_ENV_VARS["SERVER_SOFTWARE"] Xitami 
HTTP_ENV_VARS["FORM_SET"] Login 
HTTP_ENV_VARS["FORM_AUTHKEY"]  
HTTP_ENV_VARS["FORM_AUTHPASS"] 22222222 
HTTP_ENV_VARS["FORM_AUTHUSER"] Myadmin23 
HTTP_ENV_VARS["FORM_REFERERURL"] http://forum.hectorplasmic.com/frontpage.php 


So is this, but they're my "fake" variables created by the code above.  These don't show up without that code -- no HTTP_POST_VARS at all.

HTTP_POST_VARS["set"] Login 
HTTP_POST_VARS["authkey"]  
HTTP_POST_VARS["authpass"] 22222222 
HTTP_POST_VARS["authuser"] Myadmin23 
HTTP_POST_VARS["refererurl"] http://forum.hectorplasmic.com/frontpage.php 

Here's the form (stripped of HTML formatting crud):

<form method="post" action="/login.php" name="login">
 <input type="hidden" name="refererurl" value="http://forum.hectorplasmic.com/frontpage.php"><br>
 Username:  <input class="inp" type="text" name="authUser">
 Userpass:  <input class="inp" type="password" name="authPass">
 Activation code:  <input class="inp" type="text" name="authKey">
 <input class="button" type="submit" name="set" value="Login">
 <input class="button" type="reset" name="reset" value="Clear">
</form>

I beat my head on the wall trying to figure it out -- obviously, this hasn't been happening to very many people, or you'd be flooded with complaints -- but I give up, I'm whupped.  Any ideas?

After I get some sleep, I may try PHP 3.x just to see if the problem remains...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-27 04:14 UTC] pliszka at bellatlantic dot net
I have the same problem.

PHP 4
IIS 4
Windows NT 4.0 Server
 [2002-05-24 20:34 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2004-09-15 16:31 UTC] jaapjp at zonnet dot nl
I'm haveing exactly the same problem here with PHP 5.0.1 under Xitami v2.5b1 here. Xitami was installed as an NT service. PHP was installed useing the standard windows installer, useing the default settings. My system config (from phpinfo()):

System 	Windows NT OPMAAK 5.1 build 2600
Build Date 	Aug 12 2004 23:30:01
Configure Command 	cscript /nologo configure.js "--with-gd=shared" "--enable-snapshot-build"
Server API 	CGI/FastCGI
Virtual Directory Support 	enabled
Configuration File (php.ini) Path 	C:\WINDOWS\php.ini
PHP API 	20031224
PHP Extension 	20040412
Zend Extension 	220040412
Debug Build 	no
Thread Safety 	enabled
IPv6 Support 	enabled
Registered PHP Streams 	php, file, http, ftp, compress.zlib
Registered Stream Socket Transports 	tcp, udp
 [2004-10-02 09:09 UTC] ananth_rs at hotmail dot com
Have you tried to set register_long_arrays = On in the php.ini file ?
regards
Ananth Racherla
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 00:01:21 2014 UTC