Skip to content

Commit

Permalink
Fix duplicate static variable mycohorts for PHP 8.3
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 6cab796
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
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
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 6cab796

Please sign in to comment.