We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63438e7 commit 4ffe5edCopy full SHA for 4ffe5ed
main/inc/lib/database.lib.php
@@ -248,8 +248,12 @@ public static function escape_sql_wildcards($text)
248
public static function escape_string($string)
249
{
250
$string = self::getManager()->getConnection()->quote($string);
251
-
252
- 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
253
+ // Chamilo, so we need to remove the quotes around. Using trim will
254
+ // remove more than one quote if they are sequenced, generating
255
+ // broken queries and SQL injection risks
256
+ return substr($string, 1, -1);
257
}
258
259
/**
0 commit comments