Check if Apostrophes is needed when null is given
This commit is contained in:
parent
75866b6954
commit
16889f1a6a
@ -49,6 +49,10 @@ abstract class Builder
|
|||||||
*/
|
*/
|
||||||
public static function escapeText($text = "", $addApostrophes = true)
|
public static function escapeText($text = "", $addApostrophes = true)
|
||||||
{
|
{
|
||||||
|
if ($text === null) {
|
||||||
|
if ($addApostrophes) return "\"\"";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
$dangers = array('\\', '"', "\n");
|
$dangers = array('\\', '"', "\n");
|
||||||
$replacements = array('\\\\', '\\"', '\\n');
|
$replacements = array('\\\\', '\\"', '\\n');
|
||||||
$escapedText = str_ireplace($dangers, $replacements, $text);
|
$escapedText = str_ireplace($dangers, $replacements, $text);
|
||||||
|
Loading…
Reference in New Issue
Block a user