Skip to content

Commit

Permalink
Removed getcwd() usage from autoloader path discovery
Browse files Browse the repository at this point in the history
As per discussion in Roave/BackwardCompatibilityCheck#91 (comment) (#91), the autoloader
is in a fixed position, relative to the executable entry-point,
so a `getcwd()` is unnecessary, and can actually
lead to loading the wrong composer autoloader,
which in turn may lead to loading analysed files,
which is exactly what we want to avoid.
  • Loading branch information
uzibhalepu authored and Ocramius committed Aug 21, 2018
1 parent 0851c4f commit 3cb2151
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions bin/roave-backward-compatibility-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,12 @@
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use function file_exists;
use function getcwd;

(function () : void {
(function () : void {
$autoloaderLocations = [
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../autoload.php',
__DIR__ . '/../../autoload.php',
__DIR__ . '/../../../autoload.php',
getcwd() . '/vendor/autoload.php',
__DIR__ . '/../vendor/autoload.php', // Installed by cloning the project and running `composer install`
__DIR__ . '/../../../autoload.php', // Installed via `composer require`
];

foreach ($autoloaderLocations as $autoload) {
Expand Down

0 comments on commit 3cb2151

Please sign in to comment.