From 1b64533069145f8dcf8df7d1de0b84c2308ee20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Mon, 8 Apr 2013 10:06:55 +0200 Subject: [PATCH] MDL-39019 make sure MSSQL does not return non-string data types --- lib/dml/mssql_native_moodle_recordset.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/dml/mssql_native_moodle_recordset.php b/lib/dml/mssql_native_moodle_recordset.php index 1bc800bdda4..39cf1ebe0ed 100644 --- a/lib/dml/mssql_native_moodle_recordset.php +++ b/lib/dml/mssql_native_moodle_recordset.php @@ -51,6 +51,15 @@ class mssql_native_moodle_recordset extends moodle_recordset { } $row = array_change_key_case($row, CASE_LOWER); + // Moodle expects everything from DB as strings. + foreach ($row as $k=>$v) { + if (is_null($v)) { + continue; + } + if (!is_string($v)) { + $row[$k] = (string)$v; + } + } return $row; }