From 6cab796fd2fcc5938791246a1677f386d38fb4ed 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 for PHP 8.3 --- CHANGELOG.md | 4 ++++ classes/text_filter.php | 3 +-- version.php | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0617fec..f94edea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [2.6.1] 2024-10-11 +### Update +- Fixed compatibility issue with PHP 8.3. + ## [2.6.0] 2024-10-07 ### Added - New {menulanguages} tag. 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); diff --git a/version.php b/version.php index a9ce8a5..3d4f3df 100644 --- a/version.php +++ b/version.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024100700; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2024100701; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2014051200; // Requires Moodle version 2.7 or later. $plugin->component = 'filter_filtercodes'; // Full name of the plugin (used for diagnostics). -$plugin->release = '2.6.0'; +$plugin->release = '2.6.1'; $plugin->maturity = MATURITY_STABLE;