1
1
Fork 0

Update DBA::escape to match dbesc()

This commit is contained in:
Hypolite Petovan 2018-07-21 09:07:20 -04:00 committed by Hypolite Petovan
parent cfa68c52b9
commit d3a598f589

View file

@ -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);
}
}