Permalink
Browse files

Merge branch 'MDL-26520' of git://github.com/timhunt/moodle

  • Loading branch information...
2 parents 5878504 + 231ec77 commit 2875c1507ffc33fddf16761652e79b0215a3b1d4 @stronk7 stronk7 committed Mar 6, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 question/type/random/questiontype.php
@@ -260,6 +260,12 @@ function restore_session_and_responses(&$question, &$state) {
$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]

0 comments on commit 2875c15

Please sign in to comment.