Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10398 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65456 invoked by uid 1010); 10 Jun 2004 22:24:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 65432 invoked by uid 1007); 10 Jun 2004 22:24:56 -0000 Message-ID: <20040610222456.65431.qmail@pb1.pair.com> To: internals@lists.php.net Date: Thu, 10 Jun 2004 19:24:54 -0300 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 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> In-Reply-To: X-Enigmail-Version: 0.83.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9B598111BB60746191CBAB90" X-Posted-By: 201.8.4.7 Subject: Re: [PHP-DEV] stripslashes() improvements From: accerqueira@superig.com.br (Andre Cerqueira) --------------enig9B598111BB60746191CBAB90 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Thanks for replying Understood, but do you agree with me that the manual have a better chance to give a wrong idea than the right one on this? And that is giving me second thoughts about how bad it would be to change stripslashes. I think the manual could imply 2 things: a) stripslashes should only be used with results of addslashes For un-quoting addslashes: True ...and any other use would not make sense: True? b) stripslashes removes only slashes that addslashes could have put False. If the first is true, Alexander way would be true to both, just not compatible with scripts that used stripslashes with strings that didn't went through addslashes. Would you use it for any other reason than stripping added slashes? If yes, there is no possibility of changing it; If no, why bother change it? Now i notice why this discussion is pointless. Sorry, but thanks Rasmus Lerdorf wrote: > 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 --------------enig9B598111BB60746191CBAB90 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFAyN+2axdA/5C8vH8RAvCPAJ9nwZzQj0tkZHMB7doX/4IYzQVM/ACfTzba Q4KhxvtAc+TanW/S0lDDIAo= =pqfP -----END PGP SIGNATURE----- --------------enig9B598111BB60746191CBAB90--