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

Typo in get_logs_usercourse() - $$coursestart

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Execute a simple test script like this in the Moodle dirroot:

      <?php
       
      define('CLI_SCRIPT', true);
       
      require(__dir__.'/config.php');
       
      $userid = 2;
      $courseid = 1;
      $coursestart = (string)(time() - YEARSECS) . 'foobar';
       
      $logs = get_logs_usercourse($userid, $courseid, $coursestart);
       
      print_object($logs);
      

      You should get an array (empty if there are no relevant records in the log table) and not an exception.

      Show
      Execute a simple test script like this in the Moodle dirroot: <?php   define('CLI_SCRIPT', true);   require(__dir__.'/config.php');   $userid = 2; $courseid = 1; $coursestart = (string)(time() - YEARSECS) . 'foobar';   $logs = get_logs_usercourse($userid, $courseid, $coursestart);   print_object($logs); You should get an array (empty if there are no relevant records in the log table) and not an exception.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-50509-master-vartypo

      Description

      As spotted by Juan Diaz at https://moodle.org/mod/forum/discuss.php?d=314480 there is an obvious typo in the get_logs_usercourse() function:

      $$coursestart = (int)$coursestart;
      

      The line is supposed to read

      $coursestart = (int)$coursestart;
      

      to sanitize the input.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mudrd8mz David Mudrák (@mudrd8mz)
              Reporter:
              mudrd8mz David Mudrák (@mudrd8mz)
              Peer reviewer:
              Ankit Agarwal
              Integrator:
              Andrew Nicols
              Tester:
              Mark Nelson
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                6/Jul/15