8000 #25187 Lookup php binary in PHP_BINDIR first by Deltachaos · Pull Request #25188 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

#25187 Lookup php binary in PHP_BINDIR first #25188

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

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 9 additions & 1 deletion src/Symfony/Component/Process/PhpExecutableFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ public function find($includeArgs = true)
}
}

$dirs = array(PHP_BINDIR);
$dirs = array();
if ('\\' === DIRECTORY_SEPARATOR) {
$dirs[] = 'C:\xampp\php\\';
}

$name = 'php';
foreach (array('', '.exe', '.bat', '.cmd', '.com') as $suffix) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reading this, it feels like this logic belongs to the "executableFinder", isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i had changed the executable finder component first to allow looking for executables ONLY in given direcories (currently it is only able to use the given directories as fallback if the executable is not found in the environment path), but you said that it should be reduced to the strict minimum. So the question is: Where should we out this functionality for the bugfix? In long term it would make sense to extend the executable finder with this functionality.

if (@is_file($file = PHP_BINDIR.DIRECTORY_SEPARATOR.$name.$suffix) &&
('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
return $file;
}
}

return $this->executableFinder->find('php', false, $dirs);
}

Expand Down
0