Skip to content

Commit

Permalink
Fix duplicate static variable mycohorts
Browse files Browse the repository at this point in the history
  • Loading branch information
yanus authored and michael-milette committed Oct 11, 2024
1 parent 3be6684 commit cb26bc0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions classes/text_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,7 @@ public function filter($text, array $options = []) {
static $profiledata;
static $mygroupslist;
static $mygroupingslist;
static $mycohorts;

$replace = []; // Array of key/value filterobjects.

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit cb26bc0

Please sign in to comment.