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

Availability API: Better handling of invalid data in GUI

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: 2.7
    • Component/s: Conditional activities
    • Labels:
    • Testing Instructions:
      Hide

      0. Ensure conditional availability (enableavailability) is turned on at system level.
      1. Pick an activity to test this on. You will need to know the cmid of the activity.
      2. Using database editing software, run this query (modifying it to use your own database prefix, and inserting your cmid number instead of 12345678) to manually ensure the data is invalid for the activity:

      UPDATE prefix_course_modules SET availability='hahaha' WHERE id=12345678
      

      3. Click 'Purge all caches' link to reset the course cache and use the incorrect value.

      4. Look at course page

      EXPECTED: If you have debugging on, you should see a whole heap of debugging messages 'Error processing availability data', which should mention your activity either by cmid or by name.

      EXPECTED: Apart from debugging messages, the course page contents should still appear as normal, with the affected activity shown in grey.

      5. Edit settings for the activity

      EXPECTED: Again you will probably see a debugging message.

      6. Expand 'Restrict access' fieldset

      EXPECTED: The controls should be present as normal ('none', with 'Add restriction' button).

      7. Save changes and return to website

      EXPECTED: All the warnings should now go away.

      Show
      0. Ensure conditional availability (enableavailability) is turned on at system level. 1. Pick an activity to test this on. You will need to know the cmid of the activity. 2. Using database editing software, run this query (modifying it to use your own database prefix, and inserting your cmid number instead of 12345678) to manually ensure the data is invalid for the activity: UPDATE prefix_course_modules SET availability='hahaha' WHERE id=12345678 3. Click 'Purge all caches' link to reset the course cache and use the incorrect value. 4. Look at course page EXPECTED: If you have debugging on, you should see a whole heap of debugging messages 'Error processing availability data', which should mention your activity either by cmid or by name. EXPECTED: Apart from debugging messages, the course page contents should still appear as normal, with the affected activity shown in grey. 5. Edit settings for the activity EXPECTED: Again you will probably see a debugging message. 6. Expand 'Restrict access' fieldset EXPECTED: The controls should be present as normal ('none', with 'Add restriction' button). 7. Save changes and return to website EXPECTED: All the warnings should now go away.
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-45027-master

      Description

      As detected in MDL-44070, when you have dates outside the 32-bit range (after 2038) in availability conditions, and you are using a 32-bit PHP installation such as on Windows, this causes a rather catastrophic error. You can no longer see the activities on the course page, (for example in order to edit it to make the data correct).

      I don't think there is a need to actually support this situation - by 2038 let's assume that even the Windows version of PHP will be using 64-bit ints - but I think failures like this should not completely break the page - there should be debugging errors but it should at least load.

      In addition I notice there is a bug in the debugging warnings used about the invalid data (it doesn't actually display the name of the module that has the problem) so will fix this too.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14