From 13557c30ec9577e0c5897362db81d3cf10c0c5d6 Mon Sep 17 00:00:00 2001 From: Mafoo Date: Tue, 23 May 2017 16:26:33 +0100 Subject: [PATCH] BugFix [master] text class (#2598) update escape_str to more reliabiliy escape the string into a consistent format --- resources/classes/text.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/classes/text.php b/resources/classes/text.php index 058320440c..dd0577e8d7 100644 --- a/resources/classes/text.php +++ b/resources/classes/text.php @@ -185,12 +185,12 @@ class text { } private function escape_str($string = '') { - //remove \' otherwise we end up with a double escape - return preg_replace("/\\\'/", "'", $string); //perform initial escape - $string = addslashes($string); - //swap \' back otherwise we end up with a double escape + $string = addslashes(stripslashes($string)); + //swap \' as we don't need to escape those return preg_replace("/\\\'/", "'", $string); + //escape " as we write our strings double quoted + return preg_replace("/\"/", '\"', $string); } }