Remove excessive SQL quotes filtering adding risk to queries (done better) - refs BT#13285

pull/2487/head
Yannick Warnier 8 years ago
parent 63438e70ce
commit 4ffe5edb44
  1. 8
      main/inc/lib/database.lib.php

@ -248,8 +248,12 @@ class Database
public static function escape_string($string)
{
$string = self::getManager()->getConnection()->quote($string);
return trim($string, "'");
// The quote method from PDO also adds quotes around the string, which
// is not how the legacy mysql_real_escape_string() was used in
// Chamilo, so we need to remove the quotes around. Using trim will
// remove more than one quote if they are sequenced, generating
// broken queries and SQL injection risks
return substr($string, 1, -1);
}
/**

Loading…
Cancel
Save