Skip to content

Commit

Permalink
fix(ruleset): Autoload relative paths correctly to avoid confusion wi…
Browse files Browse the repository at this point in the history
…th files from the global include path
  • Loading branch information
klausi committed Dec 7, 2019
1 parent 2ecd8dc commit 5e124a8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,13 @@ public function processRuleset($rulesetPath, $depth=0)
}

$autoloadPath = (string) $autoload;
if (is_file($autoloadPath) === false) {
$autoloadPath = Util\Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);
}

if ($autoloadPath === false) {
// Try relative autoload paths first.
$relativePath = Util\Common::realPath(dirname($rulesetPath).DIRECTORY_SEPARATOR.$autoloadPath);

if ($relativePath !== false && is_file($$relativePath) === true) {
$autoloadPath = $relativePath;
} else if (is_file($autoloadPath) === false) {
throw new RuntimeException('The specified autoload file "'.$autoload.'" does not exist');
}

Expand Down

0 comments on commit 5e124a8

Please sign in to comment.