diff --git a/search/index.php b/search/index.php index 3908025920b..205f3b482f4 100644 --- a/search/index.php +++ b/search/index.php @@ -48,9 +48,6 @@ if (!empty($CFG->forcelogin)) { require_login(); } -// Unlock the session during a search. -\core\session\manager::write_close(); - require_capability('moodle/search:query', $context); $searchrenderer = $PAGE->get_renderer('core_search'); @@ -169,6 +166,9 @@ $PAGE->set_url($url); // We are ready to render. echo $OUTPUT->header(); +// Unlock the session only after outputting the header as this modifies the session cachestore. +\core\session\manager::write_close(); + // Get the results. if ($data) { $results = $search->paged_search($data, $page);