Re: Bug or Not?
| From: | (Marcus Börger) | Date: | Tue, 03 Dec 2002 16:05:27 +0000 |
| Subject: | Re: Bug or Not? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92040@lists.php.net to get a copy of this message | ||
At 16:34 03.12.2002, Adam Voigt wrote:
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.Your browser interprets the page2.php and replaces the entities &#<nn>; with their charaters. So what page3.php receives are the plain characters and not the entities. Anyway this is for php-general@lists.php.net marcus