From 1d19a5eb47ca01b910f5af6d3d5cefdafc6d4057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Mon, 8 Jun 2015 11:04:04 +0200 Subject: [PATCH] MDL-50509 datalib: Fix the typo in the variable name The line is supposed to sanitize the function parameter. --- lib/datalib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/datalib.php b/lib/datalib.php index 1775ef6e224..0ade0ad5531 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1793,7 +1793,10 @@ function get_logs_usercourse($userid, $courseid, $coursestart) { $params['courseid'] = $courseid; } $params['userid'] = $userid; - $$coursestart = (int)$coursestart; // note: unfortunately pg complains if you use name parameter or column alias in GROUP BY + // We have to sanitize this param ourselves here instead of relying on DB. + // Postgres complains if you use name parameter or column alias in GROUP BY. + // See MDL-27696 and 51c3e85 for details. + $coursestart = (int)$coursestart; return $DB->get_records_sql("SELECT FLOOR((time - $coursestart)/". DAYSECS .") AS day, COUNT(*) AS num FROM {log}