php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33655 PHP seams to not processing the POST data
Submitted: 2005-07-12 12:00 UTC Modified: 2005-07-13 09:24 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: gzsolt at yahoo dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.11 OS: Windows XP SP1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gzsolt at yahoo dot com
New email:
PHP Version: OS:

 

 [2005-07-12 12:00 UTC] gzsolt at yahoo dot com
Description:
------------
I am using PHP 4.3.11 under Windows XP. I run the CGI version from my own webserver (meaning i wrote it). The CGI support is OK i my webserver, other CGI programs working fine. The problem is the following: a simple login forms posts data to a php page. The webserver gets, the request inc. post data. It start php, sends the post data trough STDIN. PHP reads out all data from STDIN (Content-Length bytes), it gets to the $HTTP_RAW_POST_DATA variable, but the $_POST and $HTTP_POST_VARS arrays remaining empty! I have no clue what could cause this problem, possibly not a bug at all, but i did not find any problem in my php config (i can post it, if needed).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-12 15:06 UTC] mgazza2 at hotmail dot com
i have also encountered this problem i also use my own web server(one i wrote) the problem is php is not compling with cgi/1.1 php waits for return to be pressed in other words we have to write $0A $0D(#13#10) at the end of the stdin and add 2 bytes to the envar Content_Length which to me is stupid perl and cgi all work without adding these bytes php !should! by saying they suport cgi/1.1 read the length of bytes in the stdin suplied in the Content_Length envar

regards mark
 [2005-07-12 15:32 UTC] mgazza2 at hotmail dot com
we use our own self made win32 web servers running on windows xp. i have tried with php 4.4.0, 4.3.10, 4.3.8, 4.3.11.

try testing this http://solar-software.ath.cx/posttest.html

sample php script

<?php
echo '<b>HTTP_RAW_POST_DATA</b>  '.$HTTP_RAW_POST_DATA;
echo '<br /><b>HTTP_POST_VARS</b>  '.$HTTP_POST_VARS;
echo '<br /><b>_POST</b>  '.$_POST;
echo '<br /><b>_SERVER["CONTENT_LENGTH"]</b>  '.$_SERVER["CONTENT_LENGTH"];
echo '<br /><b>_SERVER["CONTENT_TYPE"]</b>  '.$_SERVER["CONTENT_TYPE"];
echo '<br /><b>_SERVER["GATEWAY_INTERFACE"]</b>  '.$_SERVER["GATEWAY_INTERFACE"];
 ?>

sample perl script

print "Content-type: text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
print "<b>Perl STDIN contains</b>  ".$buffer;
exit(0);

regards mark,
 [2005-07-12 15:46 UTC] tony2001@php.net
Actually the question was to the original reporter.

I doubt that we support some "handmade" servers, so try regular Apache first.
 [2005-07-12 16:02 UTC] mgazza2 at hotmail dot com
still what if i needed to create a game which alowed people to interface "bot" behaviour and i wanted to use php to achive this, this bug is that php is not compliant with cgi/1.1 apache will use mod_cgi and fast cgi.

the orginal post also buy the looks uses there own server also im guessing it will be totally different to mine except the way in which it calls php.

its oka i can easily fix this problem its just that the server will no longer truely be compliant with cgi/1.1

regards mark
 [2005-07-12 16:33 UTC] mgazza2 at hotmail dot com
heres a simple script to include() at the begging of all files to your server to get php $_POST to be defined
you can now thank me, :D how ever this only works with url encoded data

<?php
if ($SERVER["REQUEST_METHOD"]="POST")
  if (strtolower($SERVER["CONTENT_TYPE"])='application/x-www-form-urlencoded'){
    $ValueArray=split('[&]', $HTTP_RAW_POST_DATA);
    foreach ($ValueArray as $V){
      $V=split('=', $V);
      $_POST[$V[0]]=urldecode($V[1]);
    }
	}
?>
 [2005-07-12 16:51 UTC] mgazza2 at hotmail dot com
if (strpos($_SERVER["REQUEST_METHOD"],"POST")<>-1){
  if (strpos($_SERVER["CONTENT_TYPE"],'application/x-www-form-urlencoded')<>-1){
    $ValueArray=split('[&]', $HTTP_RAW_POST_DATA);
    foreach ($ValueArray as $V){
      $V=split('=', $V);
      $_POST[$V[0]]=urldecode($V[1]);
    }
	}
}

opps slight mistake lolz
 [2005-07-12 17:00 UTC] gzsolt at yahoo dot com
tonny2001: a few hours ago i tried the 4.4 and 5.? php (i dont remember right now, and at home i dont have internet access :( ), in both case the problem persist. If you want i can post the code, but is merely more then a form width two fields (user / pass), and a print_r($_POST); .

mgazza2: Thanks for your tip (adding the \r\n), i will try out as soon as i get home. The code you sent lately would not be an option, because i want to use php witch i did not wrote and dont want them edit (phpmyadmin for example), but thanks, if the other tip does not help, i will use it perhaps in my own scripts.

Ps.: Sorry for my bad english!
 [2005-07-12 17:14 UTC] mgazza2 at hotmail dot com
i fixed it without using the code!!
i left spaces in the envar Content_legnth and content_type
eg $_SERVER["CONTENT_LENGTH"]=' 8' perl is ok with this but php doesnt want the space check your server code to see if it was doin the same as mine

sorry php guys looks like it was my bad :(
 [2005-07-12 18:07 UTC] sniper@php.net
Fix your webserver..

 [2005-07-13 09:24 UTC] gzsolt at yahoo dot com
Ehhh... This one was a false positiv too. Neither of mgazza2's tip helped, but still one of his post contained a lead to my problem. I was accidentally set the content-type to text/html and this caused php to not to process the post data.

Sorry for the false bug report, i hope it did not caused much trouble!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC