From fa189b24daec20bd503ab5dffd97402270542118 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 12 Feb 2026 16:03:37 +0000 Subject: [PATCH] MDL-87945 webservice: handle invalid functions when adding to service. Same thing as we did for API docs in 6e9e73aba09. --- admin/webservice/forms.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/admin/webservice/forms.php b/admin/webservice/forms.php index 4f15173f35c..4f5d837c380 100644 --- a/admin/webservice/forms.php +++ b/admin/webservice/forms.php @@ -196,8 +196,12 @@ class external_service_functions_form extends moodleform { //we add the descriptions to the functions foreach ($functions as $functionid => $functionname) { //retrieve full function information (including the description) - $function = \core_external\external_api::external_function_info($functionname); - if (empty($function->deprecated)) { + try { + $function = \core_external\external_api::external_function_info($functionname); + } catch (Throwable $exception) { + $function = null; + } + if ($function !== null && empty($function->deprecated)) { $functions[$functionid] = $function->name . ':' . $function->description; } else { // Exclude the deprecated ones.