From de64b6c69e67d3607c4b826283fe02848a65da8e Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 27 Aug 2006 21:52:22 +0000 Subject: [PATCH] modify stripslashes_safe() to work properly under magic_quotes_sybase (both addslashes and stripslashes do it properly based on the setting) --- lib/weblib.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 249d22d0fa..921bb00bd9 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -358,9 +358,13 @@ function stripslashes_safe($mixed) { if (empty($mixed)) { //nothing to do... } else if (is_string($mixed)) { - $mixed = str_replace("\\'", "'", $mixed); - $mixed = str_replace('\\"', '"', $mixed); - $mixed = str_replace('\\\\', '\\', $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); -- 2.39.5