Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10393 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19561 invoked by uid 1010); 10 Jun 2004 20:43:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 19514 invoked by uid 1007); 10 Jun 2004 20:43:23 -0000 Message-ID: <20040610204322.19513.qmail@pb1.pair.com> To: internals@lists.php.net Date: Thu, 10 Jun 2004 17:43:14 -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> 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="------------enig0D492028D72422A32250B6E7" X-Posted-By: 201.8.4.7 Subject: Re: [PHP-DEV] stripslashes() improvements From: accerqueira@superig.com.br (Andre Cerqueira) --------------enig0D492028D72422A32250B6E7 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit > 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? Rasmus Lerdorf wrote: > 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 --------------enig0D492028D72422A32250B6E7 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 iD8DBQFAyMfmaxdA/5C8vH8RArYLAKCm1zbrAgT/aaCLIByCWeYoR1JTmQCg0+xI Xb8AHe8A98YVP+ny1dwGs6g= =P6hY -----END PGP SIGNATURE----- --------------enig0D492028D72422A32250B6E7--