From 025550024794fb0214556a6d6a3a87215f4afc81 Mon Sep 17 00:00:00 2001 From: Jake Dallimore Date: Thu, 21 Mar 2024 11:00:45 +0800 Subject: [PATCH] MDL-81313 core: Revert "Merge branch 'MDL-80338' This reverts commit 40f501fb4e8ccad7eaacde873bf8fa809df192c5, reversing changes made to 3061024726abdd5581d90e3a589c38b01eb533a2. --- lib/tests/moodle_url_test.php | 15 --------------- lib/weblib.php | 4 ++-- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/lib/tests/moodle_url_test.php b/lib/tests/moodle_url_test.php index 4c36c81a31151..810f88334aa5b 100644 --- a/lib/tests/moodle_url_test.php +++ b/lib/tests/moodle_url_test.php @@ -52,9 +52,6 @@ public function test_moodle_url_constructor() { $url = new \moodle_url('/index.php', null, 'test'); $this->assertSame($CFG->wwwroot.'/index.php#test', $url->out()); - $url = new \moodle_url('/index.php', null, 'Long "Anchor"'); - $this->assertSame($CFG->wwwroot . '/index.php#Long%20%22Anchor%22', $url->out()); - $url = new \moodle_url('/index.php', array('id' => 2), 'test'); $this->assertSame($CFG->wwwroot.'/index.php?id=2#test', $url->out()); } @@ -141,18 +138,6 @@ public function test_moodle_url_round_trip_array_params() { $this->assertSame($strurl, $url->out(false)); } - /** - * Test returning URL without parameters - */ - public function test_out_omit_querystring(): void { - global $CFG; - - $url = new \moodle_url('/index.php', ['id' => 2], 'Long "Anchor"'); - - $this->assertSame($CFG->wwwroot . '/index.php', $url->out_omit_querystring()); - $this->assertSame($CFG->wwwroot . '/index.php#Long%20%22Anchor%22', $url->out_omit_querystring(true)); - } - public function test_compare_url() { $url1 = new \moodle_url('index.php', array('var1' => 1, 'var2' => 2)); $url2 = new \moodle_url('index2.php', array('var1' => 1, 'var2' => 2, 'var3' => 3)); diff --git a/lib/weblib.php b/lib/weblib.php index c7ec6e278aa9b..cbaaeca17f7e5 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -621,7 +621,7 @@ public function raw_out($escaped = true, array $overrideparams = null) { $uri .= '?' . $querystring; } if (!is_null($this->anchor)) { - $uri .= '#' . rawurlencode($this->anchor); + $uri .= '#'.$this->anchor; } return $uri; @@ -641,7 +641,7 @@ public function out_omit_querystring($includeanchor = false) { $uri .= $this->port ? ':'.$this->port : ''; $uri .= $this->path ? $this->path : ''; if ($includeanchor and !is_null($this->anchor)) { - $uri .= '#' . rawurlencode($this->anchor); + $uri .= '#' . $this->anchor; } return $uri;