note 65464 rejected from function.stripslashes by bjori

From: Date: Mon, 01 May 2006 12:24:06 +0000
Subject: note 65464 rejected from function.stripslashes by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-110267@lists.php.net to get a copy of this message
Note Submitter: sven at cb3rob dot net ---- why does it just strip all slashes, instead of just the slashes escaping stuff.. a normal slash with or without spaces in between or other characters not escaped by addslashes() should NOT be removed by this function!. \" should have it's \ removed so only " remains, C:\BLA\BLA.COM should not (not added by addslashes()) 3\4 should not either. also there should be a function that continues stripping the slashes added by addslashes until no change occurs anymore, for instance when addslashes was called multiple times in buggy environments. function noslashes ($string) { while ($string!=$tmp) { $tmp=$string; $string=stripslashes($tmp); } return($string); } this is the equivalent of just regexp replacing all \'es by nothing, and that's not the way it should work as far as i can see.. it -should- leave 'stand alone' slash characters alone!

« previous php.notes (#110267) next »