Re: addslashes 3 and 4
| From: | Michael Hall | Date: | Thu, 26 Oct 2000 09:35:07 +0000 |
| Subject: | Re: addslashes 3 and 4 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22095@lists.php.net to get a copy of this message | ||
I never really got a definitive answer on this ... as with most things, I
found a fix, fixed it, and moved on. None of this is gospel, but ...
I believe that by default PHP4 automatically adds slashes to anything that
needs it, so using addslashes() adds yet another set of redundant slashes.
Whether this is because something that was already available as an option in
PHP3 is now simply enabled by default, or because of some other mechanism, I
don't know. To get my PHP3 scripts working under PHP4 I simply commented out
any addslashes() statements and everything worked fine. So the answer seems
to be "don't use addslashes() at all". All this could be dependant on how
you (or an rpm) configured PHP during install. I never touched
magic_quotes_gpc. Hope this works for you.
Michael Hall
----- Original Message -----
From: Stewart Macdonald <smacdonald@chac.qld.edu.au>
To: <mulgaweb@mulga.com.au>
Sent: Thursday, October 26, 2000 6:12 PM
Subject: Re: [PHP] addslashes 3 and 4
> > Hi all:
> > I have a script using addslashes() to deal with user input that worked
in
> > PHP3 but appears to be broken in PHP4. How do 3 and 4 differ in their
> > treatment of addslashes? I've had a look at the manual and archives, but
not
> > found a clear answer. How should a PHP3 script using addslashes() be
> > modified to work in PHP4? Don't use addslashes() at all? Would using
> > magic_quotes_gpc avoid the issue altogether?
> > Thanks
> > Mulga Mick
>
> Mulga Mick(?!?!),
>
> I have just seen the above message. You posted it to a PHP mailing list at
> some stage. I'm wondering if you ever found an answer? I'm currently
trying
> to figure out why my PHP3 scripts don't work properly with PHP4.
>
>
>
> Thanks in advance,
>
>
>
> Stewart Macdonald
> Brisbane
>