MDL-65245 question engine: response vars should always be PHP strings
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user