From debc5e451ddc7728b94d799c41cfb4c74219783a Mon Sep 17 00:00:00 2001 From: sam marshall Date: Mon, 21 Sep 2020 15:24:10 +0100 Subject: [PATCH] MDL-69758 Web services: core_get_course_contents PHP warnings Calls to core_get_course_contents can cause PHP warnings in the server log if there are any URL instances in the course with sketchy URLs. This is because url_export_contents incorrectly returns null instead of an empty array if there is an error. --- mod/url/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/url/lib.php b/mod/url/lib.php index 815360d3ae2..b8050297f9b 100644 --- a/mod/url/lib.php +++ b/mod/url/lib.php @@ -274,7 +274,7 @@ function url_export_contents($cm, $baseurl) { $fullurl = str_replace('&', '&', url_get_full_url($urlrecord, $cm, $course)); $isurl = clean_param($fullurl, PARAM_URL); if (empty($isurl)) { - return null; + return []; } $url = array();