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

glossary_print_recent_activity() function causes PHP fatal error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9.11
    • Fix Version/s: 1.9.12
    • Component/s: Glossary
    • Labels:
    • Environment:
      FreeBSD 8.1-RELEASE, PHP 5.3.5, Apache 2.2, MySQL 5.1.54
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      We have a course with a glossary, but when producing the "New glossary entries:" section of the "Recent Activity" box on the front page of the course, PHP logs an error and aborts.

      The error logged is:

      [10-Mar-2011 11:23:57] PHP Catchable fatal error: Object of class moodle_url could not be converted to string in /usr/local/www/moodle/mod/glossary/lib.php on line 314

      Line 314 reads:

      echo '<div class="info"><a href="'.$link.'">'.format_text($entry->concept, true).'</a></div>';

      The $link variable was instantiated a few lines prior to that as a moodle_url object:

      $link = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php' , $urlparams);

      My response to the error message is to use $link->out() instead of $link (see attached patch), and that seems to work. Is there a better way to fix the problem?

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/May/11