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

PHP error in Choice module

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Choice
    • Labels:
      None
    • Environment:
      XAMPP running on WinVista. Moodle 2.0 Preview 4 (Build: 20100703)
    • Database:
      Any
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      With debug mode set to developer, when I enter a Choice activity to make a choice, the following error is displayed:

      Catchable fatal error: Argument 2 passed to moodle_database::get_record() must be an array, string given, called in C:\xampp\htdocs\moodle\mod\choice\lib.php on line 299 and defined in C:\xampp\htdocs\moodle\lib\dml\moodle_database.php on line 1166

      I made the following correction to choice/lib.php

      Current:
      if ($choice->allowupdate && $aaa = $DB->get_record('choice_answers', 'choiceid', $choice->id, 'userid', $user->id)) {

      New:
      if ($choice->allowupdate && $aaa = $DB->get_record('choice_answers', array('choiceid' => $choice->id, 'userid' => $user->id))) {

        Attachments

          Activity

            People

            • Assignee:
              danmarsden Dan Marsden
              Reporter:
              bgray Brian Gray
              Tester:
              Nobody
              Participants:
              Component watchers:
              Dan Marsden, Jake Dallimore, Jun Pataleta
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10