From db0073291b0329bf77ddf906d7552fdd7e66debb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Thu, 22 Jul 2021 23:20:14 +0200 Subject: [PATCH] MDL-72203 curl: Warn if someone actually started to use $maxredirects The new parameter of curl_security_helper::url_is_blocked() introduced in MDL-71916 became part of the API. Even if we reverted it quickly, someone can use a released Moodle version that has that parameter in place. For that reason and also to avoid potential troubles in the future (e.g. when yet another argument would be added to this method), we need to make it clear that the second parameter of this method should never be used again. Poor $maxredirects, you did not live long with us. Oh well. --- lib/classes/files/curl_security_helper.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/classes/files/curl_security_helper.php b/lib/classes/files/curl_security_helper.php index 96907db346c..1c2717f9570 100644 --- a/lib/classes/files/curl_security_helper.php +++ b/lib/classes/files/curl_security_helper.php @@ -60,10 +60,15 @@ class curl_security_helper extends curl_security_helper_base { * could not be parsed, as well as those valid URLs which were found in the list of blocked ones. * * @param string $urlstring the URL to check. - * @param int $maxredirects Optional number of maximum redirects to follow - prevents infinite recursion. + * @param int $notused There used to be an optional parameter $maxredirects for a short while here, not used any more. * @return bool true if the URL is blocked or invalid and false if the URL is not blocked. */ - public function url_is_blocked($urlstring) { + public function url_is_blocked($urlstring, $notused = null) { + + if ($notused !== null) { + debugging('The $maxredirects parameter of curl_security_helper::url_is_blocked() has been dropped!', DEBUG_DEVELOPER); + } + // If no config data is present, then all hosts/ports are allowed. if (!$this->is_enabled()) { return false;