Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-39488: Lesson Module: Fixed the potential variable overwritting f…

…or answers
  • Loading branch information...
commit c0f177f19cff8e83c2af8d36416255372d18f02d 1 parent b26066b
@rwijaya rwijaya authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 mod/lesson/pagetypes/matching.php
View
11 mod/lesson/pagetypes/matching.php
@@ -161,16 +161,17 @@ public function check_answer() {
}
$response = $data->response;
- $answers = $this->get_answers();
+ $getanswers = $this->get_answers();
- $correct = array_shift($answers);
- $wrong = array_shift($answers);
+ $correct = array_shift($getanswers);
+ $wrong = array_shift($getanswers);
- foreach ($answers as $key=>$answer) {
+ $answers = array();
+ foreach ($getanswers as $key=>$answer) {
if ($answer->answer !== '' or $answer->response !== '') {
$answers[$answer->id] = $answer;
}
- unset($answers[$key]);
+ unset($getanswers[$key]);
}
// get the user's exact responses for record keeping
$hits = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.