Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal error: Uncaught TypeError: is_link(): Argument #1 #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/DrupalFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* @file
* Contains \DrupalFinder\DrupalFinder.
*/

namespace DrupalFinder;

/**
Expand Down Expand Up @@ -51,6 +50,13 @@ class DrupalFinder
*/
private $vendorDir;

/**
* Starting path.
*
* @var string
*/
private $start_path_string;

/**
* Initialize finder.
*
Expand All @@ -62,9 +68,10 @@ class DrupalFinder
* @throws \Exception
* @todo Make $start_path mandatory in v2.
*/
public function __construct($start_path = null) {
public function __construct($start_path_string = null) {
// Initialize path variables to false, indicating their locations are
// not yet known.
$this->start_path_string = $start_path_string;
$this->drupalRoot = false;
$this->composerRoot = false;
$this->vendorDir = false;
Expand Down Expand Up @@ -150,7 +157,7 @@ protected function discoverRoots($start_path) {

foreach (array(true, false) as $follow_symlinks) {
$path = $start_path;
if ($follow_symlinks && is_link($path)) {
if ($follow_symlinks && is_string($path) && is_link((string) $path)) {
$path = realpath($path);
}

Expand Down Expand Up @@ -184,8 +191,8 @@ protected function discoverRoots($start_path) {
*/
protected function findAndValidateRoots($path)
{

if (!empty($path) && is_dir($path) && file_exists($path . '/autoload.php') && file_exists($path . '/' . $this->getComposerFileName())) {
$pathString = $path;
if (!empty($pathString) && is_dir($pathString) && file_exists($pathString . '/autoload.php') && file_exists($pathString . '/' . $this->getComposerFileName())) {
// Additional check for the presence of core/composer.json to
// grant it is not a Drupal 7 site with a base folder named "core".
$candidate = 'core/includes/common.inc';
Expand Down