From 5af5e22a4c3b8c781d8cb06125e5fd344d4bab1e Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 17 Dec 2024 13:51:52 +0000 Subject: [PATCH] MDL-83474 webservice: fix empty/zero $itemid handling in text format. --- lib/external/classes/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/external/classes/util.php b/lib/external/classes/util.php index d62ce8444d8a9..8c63a763ebd73 100644 --- a/lib/external/classes/util.php +++ b/lib/external/classes/util.php @@ -543,8 +543,8 @@ public static function format_text( return ['', $textformat ?? FORMAT_MOODLE]; } - if (empty($itemid)) { - $itemid = null; + if ($itemid !== null) { + $itemid = (int) $itemid; } // Get settings (singleton).