I maintain a Moodle block (https://bitbucket.org/mwebv/moodle-block_integrityadvocate/src/master/) which uses composer's standard autoload to include several third-party libraries, including GuzzleHTTP. The problem is the PooDLL filter then comes executes and attempts to autoloads GuzzleHTTP without checking if the class/function already exists first, so we get:
--
Fatal error: Cannot redeclare GuzzleHttp\json_encode() (previously declared in /var/www/html/blocks/integrityadvocate/vendor/guzzlehttp/guzzle/src/functions.php:324) in /var/www/html/filter/poodll/3rdparty/aws-v3/GuzzleHttp/functions.php on line 322
--
I see in filter\poodll\3rdparty\aws-v3\aws-autoloader.php this code
--
spl_autoload_register(function ($class) use ($mapping) {
if (isset($mapping[$class])) {
require $mapping[$class];
}
}, true);
--
I think this code should check if the class exists - something like:
--
spl_autoload_register(function ($class) use ($mapping) {
if (isset($mapping[$class]) && !class_exists($class, false) ) {
require_once $mapping[$class];
}
}, true);
--