Re: problem with quotes (single and double) in forms
| From: | Richard Lynch | Date: | Thu, 10 Aug 2006 21:20:38 +0000 |
| Subject: | Re: problem with quotes (single and double) in forms | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240508@lists.php.net to get a copy of this message | ||
On Thu, August 10, 2006 7:54 am, afan@afan.net wrote:
> This is what I found and started to use: created magic_quotes_off.php
>
> if (get_magic_quotes_gpc())
> {
> function stripslashes_deep($value)
> {
> $value = is_array($value) ?
> array_map('stripslashes_deep', $value) :
> stripslashes($value);
>
> return $value;
> }
>
> $_POST = array_map('stripslashes_deep', $_POST);
> $_GET = array_map('stripslashes_deep', $_GET);
> $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
> }
The downside here is that having Magic Quotes on has a slight
performance penalty, and then recursing through all the stuff to just
undo that has a slight (but higher) performance penalty.
While it's unlikely to matter on a boutique site, or even on a
moderately busy site, this would probably not be a Good Idea if
performance is near the top of your list...
I'm just guessing here -- Maybe all this is so fast it just doesn't
matter.
Still seems kinda icky to me compared to a simple php.ini or .htaccess
change if you control the environment.
Obviously, if your source is released to the world at large, and you
have zero control over the environment, you're stuck with this magical
un-do.
--
Like Music?
http://l-i-e.com/artists.htm