Uh, what are you guys talking about?  That test case is bogus.

$s = 'c:\\windows\\system32';

This means that the base string we are working with is c:\windows\system32
here before any sort of stripslashes.  If you then call stripslashes() on
that, it will strip these slashes!  That's exactly what the function is
designed to do and what it is supposed to do.  If your version does not
strip these slashes, then it is not stripslashes().  stripslashes() strips
all slashes, not just slashes before ', " and \ very much by design.

I suppose it might be useful to have a version of stripslashes() which 
only strips slashes if they come before ', " or \ but this function 
wouldn't be stripslashes() and certainly shouldn't replace the existing 
stripslashes function because doing so would break all sorts of stuff.

-Rasmus

On Thu, 10 Jun 2004, Alexander Valyalkin wrote:

> On Thu, 10 Jun 2004 00:50:46 +1200, Jevon Wright <[EMAIL PROTECTED]> wrote:
> 
> >> <?php
> >> echo "Stripslashes test: ";
> >> ini_set('magic_quotes_sybase', 0);
> >> $s = 'c:\\windows\\system32';
> >> $s1 = '\\';
> >> if ($s == stripslashes($s) && $s1 == stripslashes($s1)) echo "OK\n";
> >> else echo "FAILED\n";
> >> ?>
> >
> > 'c:\\windows\\system32' becomes 'c:\windows\system32' in memory (the  
> > slashes are stripped).
> 
> I know it :)
> 
> > stripslashes() will make it 'c:windowssystem32'. Thus the above tests  
> > will fail.
> 
> Yes. The current version of stripslashes will fail on the testcase. And my  
> version
> of stripslashes successfully passes it. Read bugreports #9437, #19947,  
> #27848 and
> see sources of my stripslashes code to understand it behavior.
> 
> > This isn't a bug? (Doesn't magic_quotes_sybase only override
> > magic_quotes_gpc which affects GPC data?)
> >
> > Jevon
> 
> 
> -- 
> Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
> 
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to