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

Database: PHP Notice when rating an entry

XMLWordPrintable

    • MOODLE_19_STABLE
    • MOODLE_19_STABLE

      When creating or updating a rating for a database entry, I receive:

      Notice: Undefined property: stdClass::$cmidnumber in /home/arborrow/Moodle/code/19stable/mod/data/lib.php on line 798

      Looking into this, I see a couple of calls to grab the cmidnumber in some of the queries in /mod/data/lib.php. At the very least, I think we should check for it being set before attempting to use it. I will attach a patch for that check; however, it does seem that there is a little inconsistency in terms of what is being passed using the $data variable where sometimes it is just the record from mdl_data and other times it includes information from the course modules table (as in the data_update_grades function) where the sql statement is defined as:

      $sql = "SELECT d.*, cm.idnumber as cmidnumber
      FROM {$CFG->prefix}data d, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m
      WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";

      I'm also attaching an xdebug of the page with an error. Since this is a little difficult to trap, because of the continue refresh, I'm including a modified html file removing the refresh metatag and and javascript. I have zipped the html file and the subfolder with the various js files.

      Peace - Anthony

        1. data_rate_notice.php
          0.9 kB
        2. MDL-15566.diff
          0.9 kB
        3. MDL-15566.png
          MDL-15566.png
          153 kB

            stronk7 Eloy Lafuente (stronk7)
            aborrow Anthony Borrow
            Anthony Borrow Anthony Borrow
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.