From:             admin at ninthcircuit dot info
Operating system: Linux
PHP version:      4.3.11
PHP Bug Type:     Output Control
Bug description:  $_POST[] issue.

Description:
------------
Basically I'm wondering why PHP adds an escape character when a "\" is
submitted in a form (register globals is off). My apologies in advance if
this bug has already been reported or declared "bogus" in some other URL.
I didn't find any similar bug like when I did the advanced search, so I
thought I'd submit it.

Reproduce code:
---------------
<?php
  /* The below code is a form that will submit
   *    the field information to itself.
   * To see the problem, simply type in "te\st"
   *    (without quotes) in the text field.
   *
   * Once PHP has finished parsing the script
   *    and displays the input back to the user,
   *    it shows up as "te\\st" instead of what
   *    was expected: "te\st". Consequently, if I
   *    resubmit it unmodified, it will appear
   *    as "te\\\\st".
   * 
   * PHP continues to escape the $_POST'ed string, 
   *    when clearly it really shouldn't. */
  print "<form action=".$_SERVER['PHP_SELF']." method=post>
   <input type=text name=test value=\"".$_POST['test']."\">
   <input type=submit name=submit value=Result>";

Expected result:
----------------
I expect to see the result of the inputted data to be returned "as-is" --
that is, I expect the data to have the same appearance as when I sent it.

Actual result:
--------------
As previously mentioned, PHP returns a semi-anticipated result, with all
backslash characters escaped. This produces an undesirable "recursive"
effect, nearly doubling the number of escapes each time the form is
submitted to itself.

This could be the result of the version of PHP I'm currently working with,
however. If it is, what kind of workaround can I get for this problem?

-- 
Edit bug report at http://bugs.php.net/?id=33067&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33067&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33067&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33067&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33067&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33067&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33067&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33067&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33067&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33067&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33067&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33067&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33067&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33067&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33067&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33067&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33067&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33067&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33067&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33067&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33067&r=mysqlcfg

Reply via email to