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

When adding a glossary, "non-object" error in mod/glossary/lib.php on line 389

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.9.3
    • 1.9.2
    • Glossary
    • None
    • Windows 2003 IIS 6 (with FastCGI)
      PHP 5.2.6
      MySQL 5.0.51b
    • MySQL
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE

      When adding a Glossary, the following notice is reported by PHP:

      PHP Notice: Trying to get property of non-object in mod/glossary/lib.php on line 389

      384 if(!empty($glossary->cmidnumber))

      { 385 $params = array('itemname'=>$glossary->name, 'idnumber'=>$glossary->cmidnumber); 386 }

      else

      { 387 // MDL-14303 388 $cm = get_coursemodule_from_instance('glossary', $glossary->id); 389 $params = array('itemname'=>$glossary->name, 'idnumber'=>$cm->id); 390 }

      For some reason, $cm comes back empty, so we get the error on line 389. Maybe for a new glossary the cm record hasn't been added yet?

      I don't know how necessary it is to set idnumber, or whether it always needs to be set to the cm->id, but the following at least prevents the error from occurring

      384 $params = array('itemname'=>$glossary->name);
      385 if (array_key_exists('cmidnumber', $glossary))

      { 386 //cmidnumber may not be always present 387 $params['idnumber'] = $glossary->cmidnumber; 388 }

      Also, I was expecting to see an item in the grade book for each glossary, but there doesn't seem to be one. Again, maybe my understanding of how glossaries work may not be correct.

            skodak Petr Skoda
            xxxxxxx Gordon Bateson
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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