From f8ef28f9a6e536cdfff0dd3a3b31eab1d8543494 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 15 Nov 2022 20:11:31 +0000 Subject: [PATCH] MDL-76284 webservice: early exit if no users for missing capabilities. --- webservice/lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webservice/lib.php b/webservice/lib.php index 8ed26c54409..0107f8d1c13 100644 --- a/webservice/lib.php +++ b/webservice/lib.php @@ -684,7 +684,8 @@ class webservice { } } - if (empty($servicecaps)) { + // Bail out early if there's nothing to process. + if (empty($users) || empty($servicecaps)) { return []; }