ID: 27848 Updated by: [EMAIL PROTECTED] Reported By: spam at pasher dot org -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Debian (Linux 2.4.18-bf2.4) PHP Version: 4.3.4 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php When you create the string \\ gets converted to \, which is why the slash gets stripped by stripslashes(). Previous Comments: ------------------------------------------------------------------------ [2004-04-02 20:50:23] spam at pasher dot org Description: ------------ The stripslashes() function strips off a single trailing \ when altering a string. I can see that according to bug report http://bugs.php.net/bug.php?id=19947 , this function is not supposed to be an exact opposite of addslashes(), but it seems as thought a string that ends in a single \ should not have that slash removed, as the slash is not actually backslashing any part of the string. The only reasoning I could see behind this is that either any slash is stripped by stripslashes, or the \0 stored at the end of the C code string to terminate it (but not actually part of the PHP code string) is considered a character being "escaped". If stripslashes() is designed to simple strip any slash from a string, it seems like the design should be rethought a bit, as it can potentially produced undesired results. Reproduce code: --------------- <? echo stripslashes("this is a test\\"); ?> Expected result: ---------------- Displays "this is a test\" Actual result: -------------- Displays "this is a test" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27848&edit=1