Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10366 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78104 invoked by uid 1010); 10 Jun 2004 07:47:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 77202 invoked from network); 10 Jun 2004 07:47:14 -0000 Received: from unknown (HELO colo.lerdorf.com) (66.198.51.121) by pb1.pair.com with SMTP; 10 Jun 2004 07:47:14 -0000 Received: from [192.168.1.101] (c-24-6-1-90.client.comcast.net [24.6.1.90]) by colo.lerdorf.com (8.12.11/8.12.11/Debian-5) with ESMTP id i5A7lBOl000498; Thu, 10 Jun 2004 00:47:13 -0700 Date: Thu, 10 Jun 2004 00:47:09 -0700 (PDT) X-X-Sender: rasmus@thinkpad.lerdorf.com To: Alexander Valyalkin cc: internals@lists.php.net In-Reply-To: Message-ID: References: <00f901c44e20$62cf0170$0a00a8c0@home.jevon.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on colo Subject: Re: [PHP-DEV] stripslashes() improvements From: rasmus@php.net (Rasmus Lerdorf) 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 wrote: > > >> >> 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 >