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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 11:02:27 2025 UTC