Skip to content

Commit

Permalink
Fix the autoloader for Windows platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Jun 26, 2018
1 parent 40644f9 commit 4962d8d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libraries/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public static function loadByPsr4($class)
$classFilePath = realpath($path . DIRECTORY_SEPARATOR . substr_replace($classPath, '', 0, strlen($nsPath) + 1));

// We do not allow files outside the namespace root to be loaded
if (strpos($classFilePath, $path) !== 0)
if (strpos($classFilePath, realpath($path)) !== 0)
{
continue;
}
Expand Down Expand Up @@ -614,7 +614,7 @@ public static function loadByPsr0($class)
$classFilePath = realpath($path . DIRECTORY_SEPARATOR . $classPath);

// We do not allow files outside the namespace root to be loaded
if (strpos($classFilePath, $path) !== 0)
if (strpos($classFilePath, realpath($path)) !== 0)
{
continue;
}
Expand Down Expand Up @@ -733,7 +733,7 @@ private static function _load($class, $lookup)
$path = realpath($base . '/' . implode('/', array_map('strtolower', $parts)) . '.php');

// Load the file if it exists and is in the lookup path.
if (strpos($path, $base) === 0 && file_exists($path))
if (strpos($path, realpath($base)) === 0 && file_exists($path))
{
$found = (bool) include_once $path;

Expand All @@ -754,7 +754,7 @@ private static function _load($class, $lookup)
$path = realpath($base . '/' . implode('/', array_map('strtolower', array($parts[0], $parts[0]))) . '.php');

// Load the file if it exists and is in the lookup path.
if (strpos($path, $base) === 0 && file_exists($path))
if (strpos($path, realpath($base)) === 0 && file_exists($path))
{
$found = (bool) include_once $path;

Expand Down

0 comments on commit 4962d8d

Please sign in to comment.