Skip to content

The composerRoot property does not contain the correct value. #3

@jmolivas

Description

@jmolivas

The return TRUE; at DrupalFinder on line 88 stops the execution and makes $drupalRoot and $composerRoot contains the same value and $composerRoot never obtain the real path where the composer.json file is located.
https://github.com/webflo/drupal-finder/blob/master/src/DrupalFinder.php#L88

You can replicate by creating an example.php file containing:

use DrupalFinder\DrupalFinder;

require_once 'vendor/autoload.php';

$drupalFinder = new DrupalFinder();
$drupalFinder->locateRoot('/path/to/drupal/sites/drupal.dev/web');
$drupalRoot = $drupalFinder->getDrupalRoot();
$projectRoot = $drupalFinder->getComposerRoot();
echo 'projectRoot: ' . $projectRoot . PHP_EOL;
echo 'drupalRoot: ' . $drupalRoot . PHP_EOL;

and execute by php example.php and the output will be equal in both:

projectRoot: /path/to/drupal/sites/drupal.dev/web
drupalRoot: /path/to/drupal/sites/drupal.dev/web

Removing the offending line at 88 makes this works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions