#44876 [Opn->WFx]: stripslashes() removes backslashes in wrong cases
| From: | fa@php.net | Date: | Fri, 02 May 2008 20:32:43 +0000 |
| Subject: | #44876 [Opn->WFx]: stripslashes() removes backslashes in wrong cases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124673@lists.php.net to get a copy of this message | ||
ID: 44876
Updated by: fa@php.net
Reported By: c dot onogol at gmail dot com
-Status: Open
+Status: Wont fix
Bug Type: Scripting Engine problem
Operating System: Windows NT
PHP Version: 5.2.5
New Comment:
This is expected behaviour and has always been this way.
Previous Comments:
------------------------------------------------------------------------
[2008-04-30 21:16:17] c dot onogol at gmail dot com
Description:
------------
stripslashes is supposed to remove backslashes added by addslashes():
from the doc:
stripslashes Un-quote string quoted with addslashes()
addslashes Quote string with slashes
stripslashes return values from the documentation:
Returns a string with backslashes stripped off. (\' becomes ' and so
on.) Double backslashes (\\) are made into a single backslash (\).
The problem is that it removes single backslashes that are not escaping
any quotes/slashes.
For example, "this one \ that one" should stay the same after running
stripslashes(), but it actually is stripping the backslash, so the end
result of stripslashes("this one \ that one") is "this one that one".
the backslash in "this one \ that one" is part of the original text and
is not a backslash addslashes() would add.
Reproduce code:
---------------
<?
$str = "this one \ should stay. it\'s a \"test\"";
$str = stripslashes($str);
var_dump($str);
?>
Expected result:
----------------
string(37) "this one \ should stay. it's a "test""
Actual result:
--------------
string(36) "this one should stay. it's a "test""
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44876&edit=1