From: mudrd8mz Date: Sat, 5 Sep 2009 17:32:10 +0000 (+0000) Subject: NOBUG: Fixed bug in $PAGE->set_url() when moodle_url passed X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3a0481a4d87008facdab627cca2c63776a2bc9b6;p=moodle.git NOBUG: Fixed bug in $PAGE->set_url() when moodle_url passed 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 classes like '-mod-workshop' instead of correct 'mod-workshop' (the slash replaced with minus sign). --- diff --git a/lib/pagelib.php b/lib/pagelib.php index 0b6e9ccef6..ea0824474d 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -783,7 +783,7 @@ class moodle_page { 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().');