Skip to content
Snippets Groups Projects
Commit 84c4258e authored by Yash Rode's avatar Yash Rode Committed by Adam G-H
Browse files

Issue #3310729 by yash.rode, phenaproxima, Wim Leers, tedbow, TravisCarden:...

Issue #3310729 by yash.rode, phenaproxima, Wim Leers, tedbow, TravisCarden: ComposerValidator should check if proc_open() is available
parent 617abc36
No related branches found
No related tags found
No related merge requests found
...@@ -11,3 +11,4 @@ filedate ...@@ -11,3 +11,4 @@ filedate
unshallow unshallow
hhvm hhvm
tmpdir tmpdir
proc_open
...@@ -51,6 +51,9 @@ function package_manager_help($route_name, RouteMatchInterface $route_match) { ...@@ -51,6 +51,9 @@ function package_manager_help($route_name, RouteMatchInterface $route_match) {
$output .= '<h3 id="package-manager-faq">' . t('FAQ') . '</h3>'; $output .= '<h3 id="package-manager-faq">' . t('FAQ') . '</h3>';
$output .= '<h4 id="package-manager-composer-related-faq">' . t('FAQs related to Composer') . '</h4>'; $output .= '<h4 id="package-manager-composer-related-faq">' . t('FAQs related to Composer') . '</h4>';
$output .= '<ul>'; $output .= '<ul>';
$output .= ' <li>' . t('What if it says the <code>proc_open()</code> function is disabled on your PHP installation?');
$output .= ' <p>' . t('Ask your system administrator to remove <code>proc_open()</code> from the <a href=":url">disable_functions</a> setting in <code>php.ini</code>.', [':url' => 'https://www.php.net/manual/en/ini.core.php#ini.disable-functions']) . '</p>';
$output .= ' </li>';
$output .= ' <li>' . t('What if it says the <code>composer</code> executable cannot be found?'); $output .= ' <li>' . t('What if it says the <code>composer</code> executable cannot be found?');
$output .= ' <p>' . t("If the <code>composer</code> executable's path cannot be automatically determined, it can be explicitly set by adding the following line to <code>settings.php</code>:") . '</p>'; $output .= ' <p>' . t("If the <code>composer</code> executable's path cannot be automatically determined, it can be explicitly set by adding the following line to <code>settings.php</code>:") . '</p>';
$output .= " <pre><code>\$config['package_manager.settings']['executables']['composer'] = '/full/path/to/composer.phar';</code></pre>"; $output .= " <pre><code>\$config['package_manager.settings']['executables']['composer'] = '/full/path/to/composer.phar';</code></pre>";
......
...@@ -46,6 +46,19 @@ final class ComposerValidator implements EventSubscriberInterface { ...@@ -46,6 +46,19 @@ final class ComposerValidator implements EventSubscriberInterface {
* Validates that the Composer executable is the correct version. * Validates that the Composer executable is the correct version.
*/ */
public function validate(PreOperationStageEvent $event): void { public function validate(PreOperationStageEvent $event): void {
// If we can't stat processes, there's nothing else we can possibly do here.
// @see \Symfony\Component\Process\Process::__construct()
if (!\function_exists('proc_open')) {
$message = $this->t('Composer cannot be used because the <code>proc_open()</code> function is disabled.');
if ($this->moduleHandler->moduleExists('help')) {
$message = $this->t('@message See <a href=":package-manager-help">the help page</a> for information on how to resolve the problem.', [
':package-manager-help' => self::getHelpUrl('package-manager-composer-related-faq'),
]);
}
$event->addError([$message]);
return;
}
$messages = []; $messages = [];
$dir = $event instanceof PreApplyEvent $dir = $event instanceof PreApplyEvent
? $event->stage->getStageDirectory() ? $event->stage->getStageDirectory()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment