BugFix [master] text class (#2598)
update escape_str to more reliabiliy escape the string into a consistent format
This commit is contained in:
@@ -185,12 +185,12 @@ class text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function escape_str($string = '') {
|
private function escape_str($string = '') {
|
||||||
//remove \' otherwise we end up with a double escape
|
|
||||||
return preg_replace("/\\\'/", "'", $string);
|
|
||||||
//perform initial escape
|
//perform initial escape
|
||||||
$string = addslashes($string);
|
$string = addslashes(stripslashes($string));
|
||||||
//swap \' back otherwise we end up with a double escape
|
//swap \' as we don't need to escape those
|
||||||
return preg_replace("/\\\'/", "'", $string);
|
return preg_replace("/\\\'/", "'", $string);
|
||||||
|
//escape " as we write our strings double quoted
|
||||||
|
return preg_replace("/\"/", '\"', $string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user