Skip to content

Commit

Permalink
MDL-69415 core_h5p: prepend H5P libraries in autoloader
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sarjona committed Mar 22, 2021
1 parent 4c26696 commit 51cdc0e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion h5p/classes/local/library/handler.php
Expand Up @@ -79,7 +79,9 @@ public static function get_h5p_editor_library_base(?string $filepath = null): st
* 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);
}

/**
Expand Down

0 comments on commit 51cdc0e

Please sign in to comment.