From 0e05d93d3adf31df53cfa8f164df2437fb22b111 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 17 Oct 2023 09:48:48 +0800 Subject: [PATCH] MDL-79735 core: Drop PHP 7 support for component_callback --- lib/moodlelib.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 6d2128bf0e2..27ced1745a5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -8182,19 +8182,8 @@ function plugin_callback($type, $name, $feature, $action, $params = null, $defau * @return mixed */ function component_callback($component, $function, array $params = array(), $default = null, bool $migratedtohook = false) { - $functionname = component_callback_exists($component, $function); - if ($params && (array_keys($params) !== range(0, count($params) - 1))) { - // PHP 8 allows to have associative arrays in the call_user_func_array() parameters but - // PHP 7 does not. Using associative arrays can result in different behavior in different PHP versions. - // See https://php.watch/versions/8.0/named-parameters#named-params-call_user_func_array - // This check can be removed when minimum PHP version for Moodle is raised to 8. - debugging('Parameters array can not be an associative array while Moodle supports both PHP 7 and PHP 8.', - DEBUG_DEVELOPER); - $params = array_values($params); - } - if ($functionname) { if ($migratedtohook) { if (\core\hook\manager::get_instance()->is_deprecated_plugin_callback($function)) {