diff --git a/src/Ruleset.php b/src/Ruleset.php index 6387a6f98f..f1f28397fe 100644 --- a/src/Ruleset.php +++ b/src/Ruleset.php @@ -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'); }