Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from infostreams/patch-1
Browse files Browse the repository at this point in the history
Fixed for more recent versions of SimpleSAMLphp
  • Loading branch information
asasmoyo authored Mar 6, 2017
2 parents d2664e6 + b9a2619 commit a24b151
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion components/Simplesamlphp.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,24 @@ public function init() {
* Register Simplesamlphp autoloader
*/
public function loadSimplesamlPhp() {
// include the autoloader provided by SimpleSAMLphp
$before = get_declared_classes();
require_once($this->autoloadPath);
YiiBase::registerAutoloader('SimpleSAML_autoload', true);
$after = get_declared_classes();

if (function_exists('SimpleSAML_autoload')) {
// this is an old version of SimpleSAML, use the non-Composer version of the autoloader
YiiBase::registerAutoloader('SimpleSAML_autoload', true);
} else {
// figure out which classname Composer assigned to it, and use that instead
$diff = array_diff($after, $before);
foreach ($diff as $candidate) {
if (strpos($candidate, "ComposerAutoloaderInit")===0) {
// register the loaded Composer autoloader an autoloader with Yii
YiiBase::registerAutoloader(array($candidate, 'loadClassLoader'), true);
}
}
}
}

/**
Expand Down

0 comments on commit a24b151

Please sign in to comment.