Bladeren bron

BugFix [master] text class (#2598)

update escape_str to more reliabiliy escape the string into a consistent
format
Mafoo 8 jaren geleden
bovenliggende
commit
4f6b02627f
1 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 4 4
      resources/classes/text.php

+ 4 - 4
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);
 	}
 }