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

Block: Community - get_string errors when blocks or activities not available

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • None
    • 2.1
    • Blocks, Hub
    • MOODLE_21_STABLE
    • Hide

      turning debugging down will hide these exceptions

      Show
      turning debugging down will hide these exceptions
    • Easy
    • Hide

      1) Login to qa.moodle.net (as admin) and un-register and re-register the site
      2) Login as manager or teacher and add the community block to a course
      3) Search MOOCH for all available courses to enrol in
      4) Observe get_string notices

      Show
      1) Login to qa.moodle.net (as admin) and un-register and re-register the site 2) Login as manager or teacher and add the community block to a course 3) Search MOOCH for all available courses to enrol in 4) Observe get_string notices

      From the community block (on qa.moodle.net) when searching for Mooch courses (with debugging set to show all errors) we are getting exceptions thrown for non-existing strings. For example,

      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()

      ( ! ) Notice: Undefined property: stdClass::$backupsize in /html/blocks/community/renderer.php on line 263

      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()
      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()
      Invalid get_string() identifier: 'pluginname' or component 'block_notify_changes'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 205 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()
      Invalid get_string() identifier: 'modulename' or component 'flashcard'
      line 5910 of /lib/moodlelib.php: call to debugging()
      line 6500 of /lib/moodlelib.php: call to core_string_manager->get_string()
      line 211 of /blocks/community/renderer.php: call to get_string()
      line 233 of /blocks/community/communitycourse.php: call to block_community_renderer->course_list()

      In this case, the issue is being caused by the direct use of get_string around lines 205 and 211:

      205: $blockhtml.=get_string('pluginname','block_'.$content->modulename)." (".$content->contentcount.")";
      211: $activitieshtml .= get_string('modulename', $content->modulename);

      Since we are going to be receiving courses from any number of sites which may have who knows what in those courses, this seems like a good opportunity and reason to make use of string_exists and if it does not then we can give some other output about the block or activity module not being installed. There may be other places where you have done a similar type thing to build the course content and we should probably check for those strings first rather than allowing get_string to throw an exception.

      Peace - Anthony

            rwijaya Rossiani Wijaya
            aborrow 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.