Bug or Not?
| From: | Adam Voigt | Date: | Tue, 03 Dec 2002 15:34:21 +0000 |
| Subject: | Bug or Not? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-92037@lists.php.net to get a copy of this message | ||
I have some data that can't contain certain character's, so I have
something akin to the following:
function getProper($string)
{
$string = strip_tags($string);
$string = str_replace("][","][",$string);
$string = str_replace("'","'",$string);
$string = str_replace("\"",""",$string);
return($string);
}
Now, I have page which submit's to page2.php, on page2.php I have a
foreach loop on the $_POST array, for each iteration it prints the
hidden
input in HTML, but before that it passes each value through the above
function.
Now, when I view source everything is as expected, I see "'" instead
of
a single quote and everything, when I hit submit, and am now on
page3.php,
I do: print_r($_POST) and all the values have been re-interpreted into
there
original values (so instead of ', I see a single quote (in
view-source to)) and
my DB queriy is failing because of this, I can get around this by moving
my replace
step to the page with the DB query, but I was wondering is this a bug or
expected
behavior? Maybe it's just me, but if PHP is doing this, I wouldn't think
it should be
interpreting the values you pass back and forth at all, just pass them.
Thanks.
--
Adam Voigt (adam@cryptocomm.com)
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc