Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57056 invoked by uid 1010); 10 Jun 2004 20:52:28 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 57002 invoked from network); 10 Jun 2004 20:52:28 -0000 Received: from unknown (HELO colo.lerdorf.com) (66.198.51.121) by pb1.pair.com with SMTP; 10 Jun 2004 20:52:28 -0000 Received: from rasmus2.corp.yahoo.com (rasmus2.corp.yahoo.com [207.126.233.18]) by colo.lerdorf.com (8.12.11/8.12.11/Debian-5) with ESMTP id i5AKqQtK029923; Thu, 10 Jun 2004 13:52:26 -0700 Date: Thu, 10 Jun 2004 13:52:21 -0700 (PDT) X-X-Sender: rasmus@thinkpad.lerdorf.com To: Andre Cerqueira cc: internals@lists.php.net In-Reply-To: <20040610204322.19513.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> <20040610204322.19513.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: > > But the manual doesn't say that it *only* removes slashes > > added by addslashes. > > "Returns a string with backslashes stripped off. (\' becomes ' and so > on.) Double backslashes (\\) are made into a single backslash (\)." > > Yes, it doesn't *say*, but i think anyone could see that implied if one > didn't have previous knowledge of what it really does. > > I understand it works exactly how its supposed to, but why is it > supposed to work this way? > Inspired in something from another project? > Probably what I'm thinking as the right behavior, is what someone that > hasn't put enough thought on it would think hehe > To sum up: why was the real way choosen? I saw no real-world reason not to do it this way. Functions that trim or strip stuff should trim or strip that stuff. If you are stripping tags, you strip tags. If you are stripping slashes, you strip slashes. If you want a function that only strips slashes in a certain context, then it should be called something like strip_context_slashes. Like strip_sql_slashes. And before you start arguing that addslashes breaks that rule, it is pretty clear that anything that adds has to have some sort of context associated with it. -Rasmus