Moodle
  1. Moodle
  2. MDL-13311

Answer "0" don't save and don't work in questions

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.2, 1.8.3, 1.8.4, 1.9
    • Fix Version/s: 1.9.3
    • Component/s: Lesson
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      30615

      Description

      I created short answer question with right answer "0" (only zero in text edit field). I saved question and try. Right answer "0" did't work. I opened page for editing: answer "0" don't exist.
      I created short answer question with right answer "0" and after opened page for editing: answer "0" don't exist.
      I created Multiple Choice question with right answer "0" and several wrong answers and after opened page for editing: answer "0" don't exist.
      I try do this on demo.moodle.org -> same result...

        Activity

        Hide
        Artem Andreev added a comment -

        Problem in updatepage.php:86
        (!empty($form->answer[$i]) and trim(strip_tags($form->answer[$i]))) for "0" return 0...
        working code: (isset($form->answer[$i]) and strlen(trim(strip_tags($form->answer[$i]))))

        and continue.php:87

        (!$useranswer = $_POST['answer']) for "0" return 0
        working code:
        $useranswer = $_POST['answer'];
        if (!isset($useranswer)) {

        Show
        Artem Andreev added a comment - Problem in updatepage.php:86 (!empty($form->answer [$i] ) and trim(strip_tags($form->answer [$i] ))) for "0" return 0... working code: (isset($form->answer [$i] ) and strlen(trim(strip_tags($form->answer [$i] )))) and continue.php:87 (!$useranswer = $_POST ['answer'] ) for "0" return 0 working code: $useranswer = $_POST ['answer'] ; if (!isset($useranswer)) {
        Hide
        Martin Dougiamas added a comment -

        Will need a bit of testing

        Show
        Martin Dougiamas added a comment - Will need a bit of testing
        Hide
        Artem Andreev added a comment -

        Hmm. Why changed to "minor"? This bug breaks some Lesson functionality.
        Can you, Martin, explain different levels of priority on http://docs.moodle.org/en/How_to_write_a_good_bug_report?

        Show
        Artem Andreev added a comment - Hmm. Why changed to "minor"? This bug breaks some Lesson functionality. Can you, Martin, explain different levels of priority on http://docs.moodle.org/en/How_to_write_a_good_bug_report?

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: