php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47591 Unknown Whitespace being passed with value
Submitted: 2009-03-07 06:37 UTC Modified: 2009-03-10 17:20 UTC
From: diego at freagair dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.9 OS: Debian and FreeBSD
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: diego at freagair dot com
New email:
PHP Version: OS:

 

 [2009-03-07 06:37 UTC] diego at freagair dot com
Description:
------------
A user types in a color into an input box, it is then sent via ajax
"GET" or "POST"
to dynamically color any given "DIV", via "style.backgroundColor" or
"color". 

More specific information about the issue located at the MSDN IE
Forums: http://urloid.com/iebug2

It seems that the problem is generated by some whitespace in the PHP 
string

00380023 00380038 0000000a

This whitespace problem occurs with (Debian) and (FreeBSD)








Reproduce code:
---------------
A white space is passed after any value, the error can be seen using any IE 6-8 http://89.233.173.91/bug/

Expected result:
----------------
I would expect for the value to not contain any whitespace.  Example: 
"#333" is turned into "#333 " which causes errors with all Internet 
Explorer versions







Actual result:
--------------
Example at http://89.233.173.91/bug/ totally fails a very simple AJAX/ 
DOM script, because the PHP value contains a whitespace

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-08 14:18 UTC] kalle@php.net
What php code do you exactly use that is sent back to the browser? A small reproduce code would be needed to see if the bug is on php or browser level.
 [2009-03-08 16:28 UTC] diego at freagair dot com
Hello I have tried the following code below, but still seem to get the 
extra white space. The values have been passed via AJAX POST and GET 
but  to no avail.  All the commented code has also been used.  

<?php
//$paint = $_GET['paints'];
$paint = $_POST['paints'];

//PREVIEW COLOR
#echo trim($paint);
#echo '#AB1616';

$newStr = ereg_replace('[[:space:]]+', '', trim($paint)); 
echo $newStr;
#echo $paint;
echo trim($paint);
?>
 [2009-03-10 10:30 UTC] jani@php.net
This is most likely just user error, please try this script:

<?php
echo <<< OUT
<form method="post">
<input type="text" name="f" />
<input type="submit" />
</form>
OUT;
$f = trim($_POST['f']);
var_dump($f);
?>

Tune the form part so it actually works :)

 [2009-03-10 16:37 UTC] diego at freagair dot com
I have tried the following code and still get an error in IE

<?php
$paint = trim($_POST['paints']);
echo($paint);
?>

The IE development team says it is not IE bug....
 [2009-03-10 17:00 UTC] jani@php.net
Would you mind showing the output of the script I provided? I can NOT 
reproduce this..
 [2009-03-10 17:08 UTC] diego at freagair dot com
http://89.233.173.91/bug/test.php 

Just changed the "f" to "e"
 [2009-03-10 17:10 UTC] jani@php.net
As I suspected: It works fine with all browsers I have right now: 
IE7, Chrome, Firefox..
 [2009-03-10 17:20 UTC] diego at freagair dot com
Is the initial test http://89.233.173.91/bug/  working for you now?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 01:01:29 2024 UTC