Moodle
  1. Moodle
  2. MDL-34599

quiz attempt.php (& review.php?) should ensure $page is not out-of-range

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.1
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      1. Find or create a multi-page quiz, using a behaviour like immediate feedback that has 'Check' buttons.

      2. Attempt it as a student. During the attempt, edit the URL to change &page= to something crazy like &page=-100 or &page=1234.

      3. Verify that the first or last page is shown instead.

      4. Verify that the buttons like Check and Next work as expected.

      Show
      1. Find or create a multi-page quiz, using a behaviour like immediate feedback that has 'Check' buttons. 2. Attempt it as a student. During the attempt, edit the URL to change &page= to something crazy like &page=-100 or &page=1234. 3. Verify that the first or last page is shown instead. 4. Verify that the buttons like Check and Next work as expected.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      43034

      Description

      At the moment, if it is, you get a "no questions found" error. It would be better if it just set page to the first or last page in the quiz.

        Issue Links

          Activity

          Hide
          Dan Poltawski added a comment -

          I'm just wondering what the use case for this is, just to be friendly to people who edit urls?

          Show
          Dan Poltawski added a comment - I'm just wondering what the use case for this is, just to be friendly to people who edit urls?
          Hide
          Tim Hunt added a comment -

          The use case is the linked issue: MDL-34451. When some other bug screws up $page in the URL, or in the quiz_attempts table, the code should handle it robustly, rather than throwing a fatal error.

          Show
          Tim Hunt added a comment - The use case is the linked issue: MDL-34451 . When some other bug screws up $page in the URL, or in the quiz_attempts table, the code should handle it robustly, rather than throwing a fatal error.
          Hide
          Dan Poltawski added a comment -

          Integrated, thanks Tim.

          Show
          Dan Poltawski added a comment - Integrated, thanks Tim.
          Hide
          Dominik Jeni added a comment - - edited

          If I apply this fix, an error occurs when submitting the quiz: required parameter missing (thispage and nextpage). If I leave these two parameters like they were before (@processattempt.php), it works. (v. 2.3.1+)

          Show
          Dominik Jeni added a comment - - edited If I apply this fix, an error occurs when submitting the quiz: required parameter missing (thispage and nextpage). If I leave these two parameters like they were before (@processattempt.php), it works. (v. 2.3.1+)
          Hide
          Dan Poltawski added a comment -

          Thanks for testing Dominik, setting to failed state based on your comments.

          Show
          Dan Poltawski added a comment - Thanks for testing Dominik, setting to failed state based on your comments.
          Hide
          Tim Hunt added a comment -

          Oh crap! can we set those two params back to option_param? Dan, do you want me to make commits for that, or will you?

          Show
          Tim Hunt added a comment - Oh crap! can we set those two params back to option_param? Dan, do you want me to make commits for that, or will you?
          Hide
          Dan Poltawski added a comment -

          I made the commit (was asleep after your last comment), resetting state.

          Show
          Dan Poltawski added a comment - I made the commit (was asleep after your last comment), resetting state.
          Hide
          David Monllaó added a comment -

          It passes. Tested in 2.2 and master, both attempt and review pages; with adaptative mode on and modifying the URL the check button redirects the user to the correct (the current) page, not the faked one

          Show
          David Monllaó added a comment - It passes. Tested in 2.2 and master, both attempt and review pages; with adaptative mode on and modifying the URL the check button redirects the user to the correct (the current) page, not the faked one
          Hide
          Tim Hunt added a comment -

          Great thanks guys.

          Show
          Tim Hunt added a comment - Great thanks guys.
          Hide
          Dan Poltawski added a comment -

          asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ!

          Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

          Show
          Dan Poltawski added a comment - asko, Дзякуй, ধন্যবাদ, Благодаря, Gràcies, 感谢, 謝謝, Hvala, Díky, Tak, Bedankt, Tänan, متشکریم, Salamat, Kiitokset, Merci, Grazas, Danke, Ευχαριστώ, આભાર, תודה, धन्यवाद, Köszönjük, Takk fyrir, Terima Kasih, Grazie, ありがとうございます, Рахмет, សូមអរគុណ, 감사합니다, gratiās, Pateicamies, Ačiū, Благодарам, Tēnā koa, Kia Ora Rawa Atu, आभारी आहोत, Талархал, Takk, Dziękuję, Obrigado, Mulţumesc, Engraziel, Спасибо, Fa'afetai, Хвала, Hvala, ස්තූතියි, Vďaka, Hvala, Mahadsanid, Thanks, Gracias, Tack, Salamat, நன்றி, నెనరులు, ขอบคุณค่ะ! Your work has made it into this weeks Moodle release! There are no gold medals available this week - but millions around the world will benefit. Thank you!

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: