From 0f9e1286dd05ba02bbf63bb57832980491f16027 Mon Sep 17 00:00:00 2001 From: Misha Golenkov Date: Fri, 30 Aug 2024 17:44:34 +1000 Subject: [PATCH] FIX-305: Fix global USER change during text filtering. --- README.md | 1 + classes/text_filter.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 58a7ce7..f1dc37a 100644 --- a/README.md +++ b/README.md @@ -1535,6 +1535,7 @@ Michael Milette - Author and Lead Developer Big thank you to the following contributors. (Please let me know if I forgot to include you in the list): +* golenkovm (Micha Golenkov): FIx global USER change during text filtering (2024). * 28Smiles (Leon Camus): Bug fix for {qrcode} and {urlencode} tags (2024). * 28Smiles (Leon Camus): New {ifingouping} tag (2024). * 28Smiles (Leon Camus): New {ifnotingrouping} tag (2024). diff --git a/classes/text_filter.php b/classes/text_filter.php index 095ee3b..9a167e3 100644 --- a/classes/text_filter.php +++ b/classes/text_filter.php @@ -2379,7 +2379,7 @@ function ($matches) use ($now) { // Substitutions. - $u = $USER; + $u = clone $USER; if (!isloggedin() || isguestuser()) { $u->firstname = get_string('defaultfirstname', 'filter_filtercodes'); $u->lastname = get_string('defaultsurname', 'filter_filtercodes');