From: c dot onogol at gmail dot com
Operating system: Windows NT
PHP version: 5.2.5
PHP Bug Type: Scripting Engine problem
Bug description: stripslashes() removes backslashes in wrong cases
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 bug report at http://bugs.php.net/?id=44876&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44876&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44876&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44876&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44876&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44876&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44876&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44876&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44876&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44876&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44876&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44876&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44876&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44876&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44876&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44876&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44876&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44876&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44876&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44876&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44876&r=mysqlcfg