Skip to content

Commit

Permalink
Assume the composer autoloader has already been included somewhere (a…
Browse files Browse the repository at this point in the history
…ttempted fix for #1306)
  • Loading branch information
gsherwood committed Jan 29, 2017
1 parent a883210 commit 312402e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ public static function load($class)
if (strpos(__DIR__, 'phar://') !== 0
&& file_exists(__DIR__.'/../../autoload.php') === true
) {
self::$composerAutoloader = include_once __DIR__.'/../../autoload.php';
self::$composerAutoloader->unregister();
self::$composerAutoloader = include __DIR__.'/../../autoload.php';
if (self::$composerAutoloader instanceof \Composer\Autoload\ClassLoader) {
self::$composerAutoloader->unregister();
} else {
// Something went wrong, so keep going without the autoloader
// although namespaced sniffs might error.
self::$composerAutoloader = false;
}
} else {
self::$composerAutoloader = false;
}
Expand Down

0 comments on commit 312402e

Please sign in to comment.