ID: 44876 Updated by: [EMAIL PROTECTED] 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