Details
Description
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
Attachments
Issue Links
- has a non-specific relationship to
-
MDLQA-1121 CLONE - A teacher can add a course to the community block
- Passed
-
MDLQA-1122 CLONE - A teacher can download a community course
- Passed
- is duplicated by
-
CONTRIB-4009 community finder block, Undefined property: stdClass::$backupsize, blocks/community/renderer.php on line 263
-
- Closed
-
-
MDL-31605 Notice: Undefined property on search community course
-
- Closed
-