Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10387 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56871 invoked by uid 1010); 10 Jun 2004 15:02:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 56208 invoked from network); 10 Jun 2004 15:02:52 -0000 Received: from unknown (HELO colo.lerdorf.com) (66.198.51.121) by pb1.pair.com with SMTP; 10 Jun 2004 15:02:52 -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 i5AF2n8P005447; Thu, 10 Jun 2004 08:02:50 -0700 Date: Thu, 10 Jun 2004 08:02:47 -0700 (PDT) X-X-Sender: rasmus@thinkpad.lerdorf.com To: Andre Cerqueira cc: internals@lists.php.net In-Reply-To: <20040610093552.13990.qmail@pb1.pair.com> Message-ID: References: <20040609150030.18f59a2c.tony2001@phpclub.net> <20040609155610.0425464f.tony2001@phpclub.net> <20040610115626.7984e4b5.tony2001@phpclub.net> <20040610093552.13990.qmail@pb1.pair.com> 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) 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