When moodle_url was passed as a param to set_url(), the str_replace() kept
the leading '/' in the $shorturl. This then led to the <body> classes
like '-mod-workshop' instead of correct 'mod-workshop' (the slash
replaced with minus sign).
public function set_url($url, $params = array()) {
global $CFG;
if ($url instanceof moodle_url) {
- $shorturl = str_replace($CFG->wwwroot, '', $url->out(true));
+ $shorturl = str_replace($CFG->wwwroot . '/', '', $url->out(true));
$this->_url = clone($url);
if (!empty($params)) {
throw new coding_exception('Cannot pass params together with moodle_url to moodle_page::set_url().');