From cb26bc00fd31c533ba449a161e9a75c52f12dd9e Mon Sep 17 00:00:00 2001 From: Yannick Schillinger Date: Thu, 10 Oct 2024 10:47:18 +0200 Subject: [PATCH] Fix duplicate static variable mycohorts --- classes/text_filter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/text_filter.php b/classes/text_filter.php index 9a167e3..b8e5ed5 100644 --- a/classes/text_filter.php +++ b/classes/text_filter.php @@ -1581,6 +1581,7 @@ public function filter($text, array $options = []) { static $profiledata; static $mygroupslist; static $mygroupingslist; + static $mycohorts; $replace = []; // Array of key/value filterobjects. @@ -4281,7 +4282,6 @@ function ($matches) use ($USER) { // Parameters: id name or id number of the cohort. // Requires content between tags. if (stripos($text, '{ifincohort ') !== false) { - static $mycohorts; if (empty($mycohorts)) { // Cache list of cohorts. require_once($CFG->dirroot . '/cohort/lib.php'); $mycohorts = cohort_get_user_cohorts($USER->id); @@ -4308,7 +4308,6 @@ function ($matches) use ($mycohorts) { // Parameters: id name or id number of the cohort. // Requires content between tags. if (stripos($text, '{ifnotincohort ') !== false) { - static $mycohorts; if (empty($mycohorts)) { // Cache list of cohorts. require_once($CFG->dirroot . '/cohort/lib.php'); $mycohorts = cohort_get_user_cohorts($USER->id);