Moodle
  1. Moodle
  2. MDL-31552

Change add_to_log() exception to add exception information

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.3
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide
      1. In your Moodle instance go to "Settings -> Site administration -> Development -> Debugging"
      2. Set Debug messages to Developer
      3. Check the Display debug messages checkbox
      4. Create a script called testAddLogException.php in your Moodle root directory with the following contents
        <?php
        require_once('config.php');
        add_to_log('a', 'foo', 'bar', 'admin/foo/bar.php', 'foobar', '', $USER->id);
        
      5. Now when visiting <yourMoodleLocation>/testAddLogException.php" class="external-link" rel="nofollow">http://<yourMoodleLocation>/testAddLogException.php you should see debugging message ERROR: invalid input syntax for integer: "a"

      Before the patch you would just see "Error: Could not insert a new entry to the Moodle log"

      Show
      In your Moodle instance go to "Settings -> Site administration -> Development -> Debugging" Set Debug messages to Developer Check the Display debug messages checkbox Create a script called testAddLogException.php in your Moodle root directory with the following contents <?php require_once('config.php'); add_to_log('a', 'foo', 'bar', 'admin/foo/bar.php', 'foobar', '', $USER->id); Now when visiting <yourMoodleLocation> /testAddLogException.php" class="external-link" rel="nofollow">http:// <yourMoodleLocation> /testAddLogException.php you should see debugging message ERROR: invalid input syntax for integer: "a" Before the patch you would just see "Error: Could not insert a new entry to the Moodle log"
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      m_MDL-31552_change_add_to_log_exception_to_add_exception_information
    • Rank:
      38107

      Description

      Currently if you try to make a call to add_to_log() and the call to insert_record_raw() returns a dml_exception. The following error is shown "Error: Could not insert a new entry to the Moodle log" which doesn't really tell you anything about the issue, while information available in the exception is not being used.

        Activity

          People

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

            Dates

            • Created:
              Updated:
              Resolved: