From: spam at pasher dot org Operating system: Debian (Linux 2.4.18-bf2.4) PHP version: 4.3.4 PHP Bug Type: Strings related Bug description: stripslashes removes single trailing slash
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 bug report at http://bugs.php.net/?id=27848&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27848&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27848&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27848&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27848&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27848&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27848&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27848&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27848&r=support Expected behavior: http://bugs.php.net/fix.php?id=27848&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27848&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27848&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27848&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27848&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27848&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27848&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27848&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27848&r=float