ID:               44956
 Comment by:       c dot onogol at gmail dot com
 Reported By:      webmaster at drk dot com dot ar
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Linux
 PHP Version:      5.2.6
 New Comment:

I agree.
The documentation makes you think it's the exact opposite of 
addslashes(), both in the function description and its return values 
(which happen to be explicitly listed, and there's no mention of 
removing single slashes that are not escaping anything).


There's no string that produces "this \ that" after a call to 
addslashes().


addslashes("this that") would never output "this \ that"...

The doc says clearly "Un-quotes a quoted string", it's clear its 
purpose is to run it on strings to be inserted in a DB, why would it 
remove single slashes?


Previous Comments:
------------------------------------------------------------------------

[2008-05-09 15:43:35] webmaster at drk dot com dot ar

Description:
------------
stripslashes() removes slashes not added by addslashes()

I expect a function to do what is described in the first line of its
documentation. As published in this site "un-quotes strings quoted with
addslashes()"

It is water clear this functions isn't working as expected. As it
shouldn't remove any slash that addslashes() wouldn't add. In example, a
slash before a space won't be added by addslashes() and mustn't be
removed by stripslashes()

You can refuse to correct the code. In that case, which I consider most
useless, you ought to correct the documentation.

I ask myself won't be useful a function which undoes what addslashes()
does?

Reproduce code:
---------------
<?
$str = "the first \ should stay. it\'s the  \"right\" case";
$str = stripslashes($str);
var_dump($str);
?>

Expected result:
----------------
"the first \ should stay. it's the  "right" case"

Actual result:
--------------
"the first  should stay. it's the  "right" case"


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44956&edit=1

Reply via email to