From e736f8001794a307ae7169750d0a7702828be9a2 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Tue, 28 Mar 2023 18:48:31 +0800 Subject: [PATCH] MDL-77105 core: Cast custom data to an array when evaluating filtericon Since other modules may treat custom data as an object, we need to make cast it to an array before evaluating for the `filtericon` custom data. --- lib/modinfolib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/modinfolib.php b/lib/modinfolib.php index 4ee66b79567..a8271423290 100644 --- a/lib/modinfolib.php +++ b/lib/modinfolib.php @@ -1830,7 +1830,8 @@ class cm_info implements IteratorAggregate { // Determine whether the icon will be filtered in the CSS. // This can be controlled by the module by declaring a 'filtericon' custom data. // If the 'filtericon' custom data is not set, icon filtering will be determined whether the module has a `monologo` icon. - $filtericon = $this->customdata['filtericon'] ?? $ismonologo; + // Additionally, we need to cast custom data to array as some modules may treat it as an object. + $filtericon = ((array)$this->customdata)['filtericon'] ?? $ismonologo; if ($filtericon) { $icon->param('filtericon', 1); }