Check if Apostrophes is needed when null is given

This commit is contained in:
Beu 2023-01-16 18:43:47 +01:00
parent 75866b6954
commit 16889f1a6a

View File

@ -49,6 +49,10 @@ abstract class Builder
*/
public static function escapeText($text = "", $addApostrophes = true)
{
if ($text === null) {
if ($addApostrophes) return "\"\"";
return "";
}
$dangers = array('\\', '"', "\n");
$replacements = array('\\\\', '\\"', '\\n');
$escapedText = str_ireplace($dangers, $replacements, $text);