Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-15446

Possible undefined variable in questiontype 'match'

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.0
    • None
    • Questions
    • None
    • MOODLE_20_STABLE

    Description

      Note in the following code from question/type/match/questiontype.php that the variable $match_ans can be undefined at line 631 if the test at line 623 fails. Should be a suitable else for the if at 623.

      //Get the match_sub from backup_ids (for the answer)
      623 if ($match_answer_id) { // only recode answer if not 0, not answered yet
      624 if (!$match_ans = backup_getid($restore->backup_unique_code,"question_match_sub",$match_answer_id))

      { 625 echo 'Could not recode answer in question_match_sub '.$match_answer_id.'<br />'; 626 }

      627 }
      628
      629 if ($match_que) {
      630 //If the question hasn't response, it must be 0
      631 if (!$match_ans and $match_answer_id == 0)

      { 632 $match_ans->new_id = 0; 633 }

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              howardsmiller Howard Miller
              Nobody Nobody
              Safat Shahin, Tim Hunt, Amaia Anabitarte, Brett Dalton, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Kevin Percy, Laurent David, Mathew May, Mihail Geshoski, Sabina Abellan, Sara Arjona (@sarjona), Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: