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

Errors when a module has been removed but not uninstalled

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.4, 2.4.1
    • Fix Version/s: 2.9.5, 3.0.3
    • Component/s: Filters
    • Labels:
    • Environment:
      Independent of environment
    • Database:
      Any
    • Testing Instructions:
      Hide
      1. Install the mod_certificate module
      2. Enable the activitynames filter in a course
      3. Add a certificate the course called 'chocolate'
      4. add a label to the course with the text 'eating chocolate'
      5. VERIFY: that the activity names filter has auto-linked the activity (if not, its more likely to be misconfig, not a problem with this issue)
      6. Remove the mod_certificate files from disk (but don't uninstall it)
      7. Purge caches
      8. View the course page
      9. VERIFY: there is not a notice 'Notice: Undefined property: stdClass::$name in /Users/danp/moodles/pm/moodle/lib/modinfolib.php on line 495'
      Show
      Install the mod_certificate module Enable the activitynames filter in a course Add a certificate the course called 'chocolate' add a label to the course with the text 'eating chocolate' VERIFY: that the activity names filter has auto-linked the activity (if not, its more likely to be misconfig, not a problem with this issue) Remove the mod_certificate files from disk (but don't uninstall it) Purge caches View the course page VERIFY: there is not a notice 'Notice: Undefined property: stdClass::$name in /Users/danp/moodles/pm/moodle/lib/modinfolib.php on line 495'
    • Workaround:
      Hide

      In filter/activitynames/filter.php amend as follows:

      function filter_activitynames_comparemodulenamesbylength($a, $b)
      {
      if (!isset($a->name)) return 1;
      if (!isset($b->name)) return -1;
      // No need for 0 condition as empty string should be at bottom of heap.
      if (strlen($a->name) == strlen($b->name))

      { return 0; }

      return (strlen($a->name) < strlen($b->name)) ? 1 : -1;
      }

      Show
      In filter/activitynames/filter.php amend as follows: function filter_activitynames_comparemodulenamesbylength($a, $b) { if (!isset($a->name)) return 1; if (!isset($b->name)) return -1; // No need for 0 condition as empty string should be at bottom of heap. if (strlen($a->name) == strlen($b->name)) { return 0; } return (strlen($a->name) < strlen($b->name)) ? 1 : -1; }
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-27840-master

      Description

      With debug switched on courses that have missing activity titles produce errors although the page still loads.
      The usort called is not set up to handle blank / missing names, producing repeated errors (e.g.):

      Notice: Undefined property: stdClass::$name in .../moodle2/filter/activitynames/filter.php on line 107
      Notice: Undefined property: stdClass::$name in .../moodle2/filter/activitynames/filter.php on line 110

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                4 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Mar/16