From 9e52a6a0e1050a2a889a338b6856871398211957 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Mon, 22 Mar 2021 12:36:41 +0100 Subject: [PATCH] MDL-69415 core_h5p: prepend H5P libraries in autoloader Core and mod_hvp are using the same namespace for some H5P libraries. This is causing some random errors. In order to get the expected behaviour in Moodle core, this patch prepends H5P libraries in order to guarantee they are loaded first. Plugins using same libraries will need to use a different namespace if they overlap and a different version of these libraries should be used. --- h5p/classes/local/library/handler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/h5p/classes/local/library/handler.php b/h5p/classes/local/library/handler.php index 61089692120..3e1ee649d9d 100644 --- a/h5p/classes/local/library/handler.php +++ b/h5p/classes/local/library/handler.php @@ -79,7 +79,9 @@ abstract class handler { * Register the H5P autoloader. */ public static function register(): void { - spl_autoload_register([static::class, 'autoload']); + // Prepend H5P libraries in order to guarantee they are loaded first. Plugins using same libraries will need to use a + // different namespace if they want to use a different version. + spl_autoload_register([static::class, 'autoload'], true, true); } /**