Skip to content

Commit

Permalink
Fixed PHAR support with new composer autoloader support (ref #1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Jan 25, 2017
1 parent b03ae89 commit 890832b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public static function load($class)
// as we need to include all files so we can figure out what
// the class/interface/trait name is.
if (self::$composerAutoloader === null) {
if (file_exists(__DIR__.'/../../autoload.php') === true) {
if (strpos(__DIR__, 'phar://') !== 0
&& file_exists(__DIR__.'/../../autoload.php') === true
) {
self::$composerAutoloader = include_once __DIR__.'/../../autoload.php';
self::$composerAutoloader->unregister();
} else {
Expand Down Expand Up @@ -107,9 +109,11 @@ public static function load($class)
*/
public static function loadFile($path)
{
$path = realpath($path);
if ($path === false) {
return false;
if (strpos(__DIR__, 'phar://') !== 0) {
$path = realpath($path);
if ($path === false) {
return false;
}
}

if (isset(self::$loadedClasses[$path]) === true) {
Expand Down

0 comments on commit 890832b

Please sign in to comment.