MDL-26520 random tf questions that had not been answered were shown as answered on the summary page.

This was a regression from MDL-26236 thanks to some brain-dead PHP behaviour.
This commit is contained in:
Tim Hunt
2011-03-05 16:33:42 +00:00
parent 48fe5c6cf9
commit 231ec77323
+6
View File
@@ -260,6 +260,12 @@ class random_qtype extends default_questiontype {
$wrappedquestion->qtype = 'missingtype';
}
$state->responses[''] = substr($state->responses[''], strlen('random' . $questionid . '-'));
if ($state->responses[''] === false) {
// In PHP, if $response === $prefix, then
// substr($response, strlen($prefix)) returns false, not '',
// which is stupid, and caused MDL-26520. Fix up that case here.
$state->responses[''] = '';
}
}
if (!$QTYPES[$wrappedquestion->qtype]