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

print_log_csv, xls, and ods try to run get_field with a non-numeric ID

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.2.6
    • 2.2.7, 2.3.4, 2.4.1
    • Logging
    • None
    • MOODLE_22_STABLE
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • MDL-36640-master
    • Hide

      For 2.3 and master

      • Open a course and turn editing on
      • Add a new mod_assign with any settings you like
      • View the mod_assign you just created (this should create a suitable log entry)
      • In your DB, check you have some entries for mod_assign (SELECT * FROM mdl_log WHERE module = 'assign'; )
        • Check that at least one of these has a non-integer content in it's info field (if not, try and create some by submitting an assignment)
      • Open the site logs
      • Confirm that you have some logs displayed
      • Change the output to 'Download in text format' and get the logs
        • Confirm that the created txt file contains no HTML output or errors
      • Change the output to 'Download in ODS format'
        • Confirm that the created Open Office file actually opens and contains no errors
      • Change the output to 'Download in Excel format'
        • Confirm that the created excel file actually opens and contains no errors

      For 2.2

      It's harder to test here because the problems I've been seeing were introduced by mod_assign. That said, it should be included because there's probably something out there which does insert text into the info field.

      • Manually insert a new mdl_log entry which belongs to a valid user and course, and has some text in the info field.
      • Open the site logs
      • Confirm that you have some logs displayed
      • Change the output to 'Download in text format' and get the logs
        • Confirm that the created txt file contains no HTML output or errors
      • Change the output to 'Download in ODS format'
        • Confirm that the created Open Office file actually opens and contains no errors
      • Change the output to 'Download in Excel format'
        • Confirm that the created excel file actually opens and contains no errors
      Show
      For 2.3 and master Open a course and turn editing on Add a new mod_assign with any settings you like View the mod_assign you just created (this should create a suitable log entry) In your DB, check you have some entries for mod_assign (SELECT * FROM mdl_log WHERE module = 'assign'; ) Check that at least one of these has a non-integer content in it's info field (if not, try and create some by submitting an assignment) Open the site logs Confirm that you have some logs displayed Change the output to 'Download in text format' and get the logs Confirm that the created txt file contains no HTML output or errors Change the output to 'Download in ODS format' Confirm that the created Open Office file actually opens and contains no errors Change the output to 'Download in Excel format' Confirm that the created excel file actually opens and contains no errors For 2.2 It's harder to test here because the problems I've been seeing were introduced by mod_assign. That said, it should be included because there's probably something out there which does insert text into the info field. Manually insert a new mdl_log entry which belongs to a valid user and course, and has some text in the info field. Open the site logs Confirm that you have some logs displayed Change the output to 'Download in text format' and get the logs Confirm that the created txt file contains no HTML output or errors Change the output to 'Download in ODS format' Confirm that the created Open Office file actually opens and contains no errors Change the output to 'Download in Excel format' Confirm that the created excel file actually opens and contains no errors

    Description

      Some add_to_log functions are adding text into the info field of the log table.
      Whilst course/lib.php::print_log() handles these correctly, the corresponding functions for CSV, XLS, and ODS output do not.

      They're all missing a check for is_numeric($log->info) which results in get_field() trying to fetch from a table (mdl_assign in my case) using a string for the ID field and throwing DB exceptions.

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Sam Hemelryk Sam Hemelryk
              Frédéric Massart Frédéric Massart
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                14/Jan/13