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

[console] Error when using with Composer 2.1.3 #4308

Open
SOMERSOFTAndrewCrook opened this issue Jul 6, 2021 · 0 comments
Open

[console] Error when using with Composer 2.1.3 #4308

SOMERSOFTAndrewCrook opened this issue Jul 6, 2021 · 0 comments

Comments

@SOMERSOFTAndrewCrook
Copy link

Problem/Motivation

On composer install Composer 2.1.3 creates this drupal file in bin-dir directory as follows

#!/usr/bin/env php
<?php

/**
 * Proxy PHP file generated by Composer
 *
 * This file includes the referenced bin path (../drupal/console/bin/drupal) using eval to remove the shebang if present
 *
 * @generated
 */

$binPath = realpath(__DIR__ . "/" . '../drupal/console/bin/drupal');
$contents = file_get_contents($binPath);
$contents = preg_replace('{^#!/.+\r?\n<\?(php)?}', '', $contents, 1, $replaced);
if ($replaced) {
    $contents = strtr($contents, array(
        '__FILE__' => var_export($binPath, true),
        '__DIR__' => var_export(dirname($binPath), true),
    ));

    eval($contents);
    exit(0);
}
include $binPath;

The issue is that the drupal file then includes drupal.php which is not found on include_path nor in the current directory

#!/usr/bin/env php
<?php

require 'drupal.php';

This then fails when running bin-dir/drupal

docker@cli:/var/www$ composer show | grep drupal/console
drupal/console                            1.9.7              The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
drupal/console-core                       1.9.7              Drupal Console Core
drupal/console-en                         v1.9.7             Drupal Console English Language
drupal/console-extend-plugin              0.9.5              Drupal Console Extend Plugin

Solution

Apply patch file to update drupal.php.

diff --git a/bin/drupal b/bin/drupal
index 54109783..042424e2 100755
--- a/bin/drupal
+++ b/bin/drupal
@@ -1,4 +1,4 @@
 #!/usr/bin/env php
 <?php
 
-require 'drupal.php';
+require __DIR__ . '/drupal.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant