From 9fd05a5061bc0744c13ac7a8ad9939dfce4b7706 Mon Sep 17 00:00:00 2001 From: Sarah Cotton Date: Wed, 15 Mar 2023 11:30:05 +0000 Subject: [PATCH 1/2] Fix Guzzle conflicts in Moodle 4.2 --- sdk/aws-autoloader.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sdk/aws-autoloader.php b/sdk/aws-autoloader.php index 1003138a2..8349834c0 100644 --- a/sdk/aws-autoloader.php +++ b/sdk/aws-autoloader.php @@ -2820,15 +2820,25 @@ 'Symfony\Polyfill\Intl\Idn\bootstrap' => __DIR__ . '/Symfony/Polyfill/Intl/Idn/bootstrap.php', ); +global $CFG; + spl_autoload_register(function ($class) use ($mapping) { if (isset($mapping[$class])) { require $mapping[$class]; } }, true); -require __DIR__ . '/Aws/functions.php'; -require __DIR__ . '/GuzzleHttp/functions_include.php'; -require __DIR__ . '/GuzzleHttp/Psr7/functions_include.php'; -require __DIR__ . '/GuzzleHttp/Promise/functions_include.php'; -require __DIR__ . '/JmesPath/JmesPath.php'; -require __DIR__ . '/Symfony/Polyfill/Intl/Idn/bootstrap.php'; +if (!function_exists('Aws\constantly')) { + require_once __DIR__ . '/Aws/functions.php'; +} + +if ($CFG->branch >= 402) { + require_once $CFG->dirroot. '/lib/guzzlehttp/guzzle/src/functions_include.php'; +} else { + require_once __DIR__ . '/GuzzleHttp/functions_include.php'; +} + +require_once __DIR__ . '/GuzzleHttp/Psr7/functions_include.php'; +require_once __DIR__ . '/GuzzleHttp/Promise/functions_include.php'; +require_once __DIR__ . '/JmesPath/JmesPath.php'; +require_once __DIR__ . '/Symfony/Polyfill/Intl/Idn/bootstrap.php'; From 555f155944f5b3faa0a61531e9bef1dcdcbc88c0 Mon Sep 17 00:00:00 2001 From: Sarah Cotton <2684004+sarahjcotton@users.noreply.github.com> Date: Thu, 3 Aug 2023 12:06:02 +0100 Subject: [PATCH 2/2] Update sdk/aws-autoloader.php Co-authored-by: Mark Webster <34059412+mark-webster-catalyst@users.noreply.github.com> --- sdk/aws-autoloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/aws-autoloader.php b/sdk/aws-autoloader.php index 8349834c0..e3e3f4eba 100644 --- a/sdk/aws-autoloader.php +++ b/sdk/aws-autoloader.php @@ -2832,7 +2832,7 @@ require_once __DIR__ . '/Aws/functions.php'; } -if ($CFG->branch >= 402) { +if ($CFG->branch >= 402 || file_exists($CFG->dirroot. '/lib/guzzlehttp/guzzle/src/functions_include.php')) { require_once $CFG->dirroot. '/lib/guzzlehttp/guzzle/src/functions_include.php'; } else { require_once __DIR__ . '/GuzzleHttp/functions_include.php';