-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
3.2.3
-
None
-
MOODLE_32_STABLE
-
-
The External Tool (LTI) module breaks if a course's shortname or fullname contains more than 75 characters.
We have noticed this behaviour in several courses after the update from Moodle 3.1 to 3.2.
MDL-58770 introduced HTML stripping in function lti_build_request() in mod/lti/locallib.php through the function html_to_text() in lib/weblib.php
https://git.moodle.org/gw?p=moodle.git;a=commit;h=1768b85f09e45caa954d21022ffaf4f82c4dc5d3
'context_label' => trim(html_to_text($course->shortname)), |
'context_title' => trim(html_to_text($course->fullname)), |
html_to_text() by default wraps the text at 75 characters, which shows as %0D%0A in LTI POST's context_label or context_title. This seems to break LTI functionality.
As a temporary fix, adding ", 0, false" to the function arguments makes LTI behave correctly again.
'context_label' => trim(html_to_text($course->shortname, 0, false)), |
'context_title' => trim(html_to_text($course->fullname, 0, false)), |
The same changes should probably be applied to resource_link_title as well...
$requestparams['resource_link_title'] = trim(html_to_text($instance->name, 0, false)); |
... and to tool_consumer_instance_name and tool_consumer_instance_description in function lti_build_standard_request().
if (!empty($CFG->mod_lti_institution_name)) { |
$requestparams['tool_consumer_instance_name'] = trim(html_to_text($CFG->mod_lti_institution_name, 0, false)); |
} else { |
$requestparams['tool_consumer_instance_name'] = trim(html_to_text(get_site()->shortname, 0, false)); |
}
|
$requestparams['tool_consumer_instance_description'] = trim(html_to_text(get_site()->fullname, 0, false)); |