php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39837 POST improper handling of application/x-www-form-urlencode
Submitted: 2006-12-14 23:49 UTC Modified: 2006-12-17 18:17 UTC
From: miles at milespawski dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.0 OS: windows xp
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: miles at milespawski dot com
New email:
PHP Version: OS:

 

 [2006-12-14 23:49 UTC] miles at milespawski dot com
Description:
------------
When sending POST data by xmlhttp-ajax method from jscript client to 2.2.3 apache server (PHP receipt container), the spaces in the data are not converted to "+" signs as they are supposed to be with MIME type application/x-www-form-urlencode.  It worked before with older PHP and Apache.  Apache.org sent me over here.
I can get around this by doing a php str_replace(" ","+") to the data.

Reproduce code:
---------------
for the record:
client (partial)- 
======
var ops = "data_container.php?file="+ filenm + "&user=" +   
  user + "&sid="+Math.random() 
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
xmlhttp.onreadystatechange=loadSizes;
xmlhttp.open('POST', ops, false);
xmlhttp.setRequestHeader("Content-Type", 
  "application/x-www-form-urlencoded")
xmlhttp.send("xx__val=" + Base64data);

Server-
<?php
$file = $_GET['file'];
$user = $_GET['user'];
echo "<form name='form1' method='post' action=''   
   enctype='multipart/form-data' target='_blank'>";
$pre_contents = $_POST['xx__val'];
 



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-17 18:17 UTC] iliaa@php.net
The url encoding is done by the browser not PHP.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 05:01:32 2024 UTC