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.
This commit is contained in:
sam marshall
2020-09-21 15:28:11 +01:00
parent 611399214b
commit 62ea8b1cae
+1 -1
View File
@@ -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();