MDL-65245 question engine: response vars should always be PHP strings

This commit is contained in:
Tim Hunt
2019-04-02 16:32:40 +01:00
parent 6c91e515b0
commit be492e2a8f
+7
View File
@@ -1069,6 +1069,13 @@ class question_attempt {
$var = null;
}
if ($var !== null) {
// Ensure that, if set, $var is a string. This is because later, after
// it has been saved to the database and loaded back it will be a string,
// so better if the type is predictably always a string.
$var = (string) $var;
}
return $var;
}
}