On Thu, 10 Jun 2004, Andre Cerqueira wrote:
> The 2 first bugs where really bogus, but imho the last one did make sense.
>
> If stripslashes does "Un-quote string quoted with addslashes()", how
> addslashes would come up with:
> > c:\windows\system32
> from:
> > c:windowssystem32
It can't! How would it? Nobody has ever stated that addslashes() can
undo a stripslashes() call. That's like expecting there to be an untrim()
call to match trim(), for example.
> a) stripslashes() were meant to strip all slashes
> This confused me, probably i misinterpreted...
> Wouldnt it be like calling strtr($string, '\\', '')?
Not quite, stripslashes() understands the sybase style of escaping ('')
and it is faster than strtr for that case.
> b) stripslashes() were meant to strip all slashes but the ones followed
> by a slash (if any)
> This is how it works now
> Though it makes (stripslashes(addslashes(string)) == string) true, it
> doesnt make (addslashes(stripslashes(string)) == string) necessarily true.
Correct. The goal of stripslashes() was simply to get rid of the set of
slashes added by magic_quotes for display purposes and it achieves this
quite nicely.
> c) stripslashes() were meant to strip all slashes added by addslashes
> This is what the manual says.
And it does. But the manual doesn't say that it *only* removes slashes
added by addslashes.
-Rasmus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php