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
signature.asc
Description: OpenPGP digital signature