diff --git a/lib/_autoload.php b/lib/_autoload.php new file mode 100644 index 0000000000000000000000000000000000000000..4eabbc022ec4c73829dcd7a408e0bc02687e2fb0 --- /dev/null +++ b/lib/_autoload.php @@ -0,0 +1,22 @@ +<?php + +/** + * This file is a backwards compatible autoloader for SimpleSAMLphp. + * Loads the Composer autoloader. + * + * @package SimpleSAMLphp + */ + +declare(strict_types=1); + +// SSP is loaded as a separate project +if (file_exists(dirname(dirname(__FILE__)) . '/vendor/autoload.php')) { + require_once dirname(dirname(__FILE__)) . '/vendor/autoload.php'; +} else { + // SSP is loaded as a library + if (file_exists(dirname(dirname(__FILE__)) . '/../../autoload.php')) { + require_once dirname(dirname(__FILE__)) . '/../../autoload.php'; + } else { + throw new Exception('Unable to load Composer autoloader'); + } +} diff --git a/www/_include.php b/www/_include.php index 8f95031bccc6b261ee1d2a79b6f6485bdb4f574a..893f1fbf3798d963640dd0074ed273b727960564 100644 --- a/www/_include.php +++ b/www/_include.php @@ -1,5 +1,8 @@ <?php +// initialize the autoloader +require_once(dirname(dirname(__FILE__)) . '/lib/_autoload.php'); + use SAML2\Compat\ContainerSingleton; use SimpleSAML\Compat\SspContainer; use SimpleSAML\Configuration;