modify stripslashes_safe() to work properly under magic_quotes_sybase

(both addslashes and stripslashes do it properly based on the setting)
This commit is contained in:
stronk7 2006-08-27 21:52:22 +00:00
parent f2b5d7e3b7
commit de64b6c69e

View File

@ -358,9 +358,13 @@ function stripslashes_safe($mixed) {
if (empty($mixed)) {
//nothing to do...
} else if (is_string($mixed)) {
if (ini_get_bool('magic_quotes_sybase')) { //only unescape single quotes
$mixed = str_replace("''", "'", $mixed);
} else { //the rest, simple and double quotes and backslashes
$mixed = str_replace("\\'", "'", $mixed);
$mixed = str_replace('\\"', '"', $mixed);
$mixed = str_replace('\\\\', '\\', $mixed);
}
} else if (is_array($mixed)) {
foreach ($mixed as $key => $value) {
$mixed[$key] = stripslashes_safe($value);