|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-05-02 20:32 UTC] fa@php.net
[2008-05-02 21:52 UTC] c dot onogol at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 22:00:01 2025 UTC |
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""