MDL-71410 core: Prevent recursively calling getters

This commit is contained in:
Shamim Rezaie
2021-04-27 14:34:09 +10:00
parent d8806cc8aa
commit b315affbd4
3 changed files with 15 additions and 4 deletions
+3 -1
View File
@@ -1117,7 +1117,9 @@ class completion_info {
// Custom activity module completion data.
// Cast custom data to array before checking for custom completion rules.
$customdata = (array)$cm->customdata;
// We call ->get_custom_data() instead of ->customdata here because there is the chance of recursive calling,
// and we cannot call a getter from a getter in PHP.
$customdata = (array) $cm->get_custom_data();
// Return early if the plugin does not define custom completion rules.
if (empty($customdata['customcompletionrules'])) {
return $data;