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

Typo in get_logs_usercourse() - $$coursestart

    XMLWordPrintable

Details

    • MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • MOODLE_28_STABLE, MOODLE_29_STABLE
    • MDL-50509-master-vartypo
    • 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.

    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

              mudrd8mz David Mudrák (@mudrd8mz)
              mudrd8mz David Mudrák (@mudrd8mz)
              Ankit Agarwal Ankit Agarwal
              Andrew Lyons Andrew Lyons
              Mark Nelson Mark Nelson
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                6/Jul/15