From: Hypolite Petovan Date: Sat, 21 Jul 2018 13:07:20 +0000 (-0400) Subject: Update DBA::escape to match dbesc() X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d3a598f589a44c62817664f20d0d548697e631c5;p=friendica.git Update DBA::escape to match dbesc() --- diff --git a/src/Database/DBA.php b/src/Database/DBA.php index 8e5a621b36..87b2476d4f 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -251,11 +251,15 @@ class DBA } public static function escape($str) { - switch (self::$driver) { - case 'pdo': - return substr(@self::$connection->quote($str, PDO::PARAM_STR), 1, -1); - case 'mysqli': - return @self::$connection->real_escape_string($str); + if (self::$connected) { + switch (self::$driver) { + case 'pdo': + return substr(@self::$connection->quote($str, PDO::PARAM_STR), 1, -1); + case 'mysqli': + return @self::$connection->real_escape_string($str); + } + } else { + return str_replace("'", "\\'", $str); } }