php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24753 missing character in POST data
Submitted: 2003-07-22 09:32 UTC Modified: 2003-07-23 05:49 UTC
From: robin at newloop dot com Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.3.2 OS: Win XP Pro 2002 SP1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: robin at newloop dot com
New email:
PHP Version: OS:

 

 [2003-07-22 09:32 UTC] robin at newloop dot com
Description:
------------
On requesting POST data using $_POST or $_REQUEST that 
is being sent using Macromedia Flash MX, the last 
character of the last request is missing. Work around 
is to send a dummy variable as the last request.

Reproduce code:
---------------
<?
$filePath = stripslashes($_REQUEST["cmsFilePath"]);
$fileDataTotal = stripslashes($_REQUEST["cmsFileDataTotal"]);
$fileData = " ";
for ($counter = 0; $counter < $fileDataTotal; $counter ++){
	$newPart = stripslashes($_REQUEST["cmsFileData".$counter]);
	$fileData = $fileData.$newPart;
}
$fileName = stripslashes($_REQUEST["cmsFileName"]);
$test = stripslashes($_REQUEST["cmstest"]);
$start = time();
while (time()<($start +5)) {
}
$tfile = $filePath."/".$fileName;
touch($tfile);
chmod($tfile, 0666);
$handle = fopen($tfile, "wb");
fwrite($handle, $fileData.$test);
fclose($handle);
?>

Expected result:
----------------
the $test variable should contain the string "hello" 

Actual result:
--------------
the $test variable actually contains "hell"
All other variables are ok.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-22 10:26 UTC] robin at newloop dot com
have just tried this but seems to make no difference. 
Any ideas? It's IIS 5.1 if that helps.
 [2003-07-22 11:14 UTC] iliaa@php.net
1) Are you using as isapi module or CGI, if you are using the isapi module try CGI and see if the problem persists.
2) Is the 1st character of the last variable missing when you use $_POST?
3) Do you have register_globals enabled or disabled?
 [2003-07-22 11:47 UTC] robin at newloop dot com
thanks for your help on this;
1) I am using it as CGI already.
2) The first charater is present and correct. I am 
getting an un-asked-for " " at the beginning of my 
file, though.
3) Not sure about this. I haven't been using PHP for 
very long. how can I check for it?
 [2003-07-22 11:50 UTC] iliaa@php.net
<?php
var_dump(ini_get("register_globabls"));
?>
Will tell you if you have register_globals enabled.

As for the space, make sure you have no spaces before the <?php (or <?) in your script.
 [2003-07-22 12:10 UTC] robin at newloop dot com
again, big thanks!
register globals is Off

Worked out the space thing. Doh!
had a line specifically adding it:
$fileData = " ";
 [2003-07-22 12:24 UTC] derick@php.net
Bogus then :)
 [2003-07-22 12:33 UTC] robin at newloop dot com
no, still open. That Doh! was for something else. 

There is still a problem with the last POST variable 
requested missing it's last character. 

I could, of course just add an extra character, or 
dummy variable, but I'd rather know if I'm working 
around a feature or a bug, or if I'm simply doing 
something wrong?
 [2003-07-22 12:47 UTC] iliaa@php.net
Try to make a simple script just to see if the bug is particular to the script you are using or any POST request. I find it extremely unusual that _POST contains correct data while _REQUEST does not, since _REQUEST is built using data from _POST.
 [2003-07-22 12:51 UTC] robin at newloop dot com
will try some tests from html pages as well as flash.

The problem exists on both _REQUEST and _POST. It's the 
.last. character that goes missing. Will let you know 
what I find.
 [2003-07-23 05:10 UTC] robin at newloop dot com
ok, a simple test that passes a single value to php.

From HTML - no problem. 
http://www.monkeydo.co.uk/php/phptest.html

From Flash there is only a problem on the first call to 
the php.
http://www.monkeydo.co.uk/php/phptest.swf

Both call the same php script:

<?php
$test = stripslashes($_REQUEST["test"]);
echo ("phptest=".$test)
?>

I'm going to try looking at some flash advice on this 
as well, but I have been using ASP previously with no 
such problems from Flash, so not sure where the problem 
is occuring.
 [2003-07-23 05:49 UTC] robin at newloop dot com
Thanks for all your help - have narrowed it down to the 
browser I am using. The problem lies with an apparently 
known issue with Apple's Safari in dealing with POST 
data.

Sorry to have wasted your time, but I'm going to use 
PHP from now on as ASP just doesn't compare to PHP and 
this kind of support is wonderful.

Bogus!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC