hechoendrupal / drupal-console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
http://drupalconsole.com
GNU General Public License v2.0
939 stars 560 forks source link

All 'drupal' commands end with php warning #3807

Open justclint opened 6 years ago

justclint commented 6 years ago

All 'drupal' commands end with php warning

[ ISSUE-GROUP ] * console

Problem/Motivation

The errors below is outputted with any/all drupal commands. From what I can tell the commands do run but then finish with these warnings.

How to reproduce

Run any drupal command.

Details to include:

PHP Strict warning: Drupal\Console\Core\Command\Command and                           
         Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait define the same property ($translator) in the    
         composition of Drupal\Console\Command\Generate\JsTestCommand. This might be incompatible, to improve           
         maintainability consider using accessor methods in traits instead. Class was composed in <em                   
         class="placeholder">require()</em> (line <em class="placeholder">126</em> of <em                               
         class="placeholder">/var/www/padiblt/vendor/drupal/console/src/Command/Generate/JsTestCommand.php</em>). <pre  
         class="backtrace">require(&#039;/var/www/padiblt/vendor/drupal/console/src/Command/Generate/JsTestCommand.php&#
         039;) (Line: 110)                                                                                              
         Symfony\Component\ClassLoader\ApcClassLoader-&gt;loadClass(&#039;Drupal\Console\Command\Generate\JsTestCommand&
         #039;)                                                                                                         
         spl_autoload_call(&#039;Drupal\Console\Command\Generate\JsTestCommand&#039;)                                   
         ReflectionClass-&gt;__construct(&#039;Drupal\Console\Command\Generate\JsTestCommand&#039;) (Line: 28)          
         Drupal\Console\Annotations\DrupalCommandAnnotationReader-&gt;readAnnotation(&#039;Drupal\Console\Command\Genera
         te\JsTestCommand&#039;) (Line: 48)                                                                             
         Drupal\Console\Utils\AnnotationValidator-&gt;isValidCommand(&#039;Drupal\Console\Command\Generate\JsTestCommand
         &#039;) (Line: 125)                                                                                            
         Drupal\Console\Application-&gt;validateCommands() (Line: 62)                                                   
         Drupal\Console\Application-&gt;doRun(Object, Object) (Line: 125)                                               
         Symfony\Component\Console\Application-&gt;run() (Line: 89)                                                     
         require(&#039;/var/www/padiblt/vendor/drupal/console/bin/drupal.php&#039;) (Line: 4)                           
jmolivas commented 6 years ago

@justclint which OS and PHP are you using?

justclint commented 6 years ago

Hi @jmolivas , on OSX 10.13.2 with php5.6. Thanks!

mparker17 commented 6 years ago

I'm also getting the same errors.

Drupal Console is installed using composer (i.e.: as vendor/bin/drupal in a Drupal site repo). I'm running macOS Sierra 10.12.6 (16G1212); MAMP 4.4.1 (3114), PHP 5.6.32, with the following (relevant) lines in php.ini:

error_reporting  =  E_ALL
display_errors = On
display_startup_errors = On

Other relevant information:

$ vendor/bin/drupal --version
Drupal Console version 1.6.1

My composer.json looks like:

{
  ...
  "require": {
    ...
    "drupal/console": "~1.0",
    ...
  }
  "minimum-stability": "dev",
  "prefer-stable": true,
  ...
}

And composer.lock has the following snippet relevant to Drupal console:

          {
            "name": "drupal/console",
            "version": "1.6.1",
            "source": {
                "type": "git",
                "url": "https://github.com/hechoendrupal/drupal-console.git",
                "reference": "85a6948f80eb7584dcfeeecd49f9ade5c7fb1a15"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/hechoendrupal/drupal-console/zipball/85a6948f80eb7584dcfeeecd49f9ade5c7fb1a15",
                "reference": "85a6948f80eb7584dcfeeecd49f9ade5c7fb1a15",
                "shasum": ""
            },
            "require": {
                "alchemy/zippy": "0.4.3",
                "composer/installers": "~1.0",
                "doctrine/annotations": "^1.2",
                "doctrine/collections": "^1.3",
                "drupal/console-core": "1.6.1",
                "drupal/console-extend-plugin": "~0",
                "guzzlehttp/guzzle": "~6.1",
                "php": "^5.5.9 || ^7.0",
                "psy/psysh": "0.6.* || ~0.8",
                "symfony/css-selector": "~2.8|~3.0",
                "symfony/dom-crawler": "~2.8|~3.0",
                "symfony/http-foundation": "~2.8|~3.0"
            },
            ...
            "autoload": {
                "psr-4": {
                    "Drupal\\Console\\": "src"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            ...
            "time": "2018-02-21T16:06:59+00:00"
        }
jmolivas commented 6 years ago

@mparker17 awesome thanks for the info will help with the testing.

TechnoMag3 commented 6 years ago

I am getting the same on XAMPP / Windows NT 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack 1) i586 / PHP 5.6.19 / Drupal Console 1.7

theodorosploumis commented 6 years ago

Same form me.

bobchristenson commented 6 years ago

Same errors here on MAMP / OS X ...any update on the cause? I should also note that before it throws this long error, I get this right before it: [ERROR] SQLSTATE[HY000] [2002] No such file or directory

jmolivas commented 6 years ago

@bobchristenson for the error

[ERROR] SQLSTATE[HY000] [2002] No such file or directory

Please check https://docs.drupalconsole.com/en/drupal_console_faq/installation-problems.html

bobchristenson commented 6 years ago

@jmolivas thanks, that got rid of the "no such..." error. But the error in this issue persists.

Eyal-Shalev commented 6 years ago

any news concerning this issue?

jmolivas commented 6 years ago

This PR should fix the issue. https://github.com/hechoendrupal/drupal-console/pull/3865

The patch can be applied via composer using: https://github.com/hechoendrupal/drupal-console/pull/3865.patch

Eyal-Shalev commented 6 years ago

@jmolivas The patch you provided does not fix the issue.

Nuuou commented 6 years ago

I'm experiencing this same issue, #3865 isn't fixing it for me either.

theodorosploumis commented 6 years ago

I managed to remove the Warning by removing the use CommandTrait; from these files:

The problem is that I cannot apply a patch for console-core to test this since this folder is coming from package "symfony/console".

Or am I missing something?

jmolivas commented 6 years ago

Thanks @theodorosploumis I will test and send a PR to the projects

mikran commented 6 years ago

@jmolivas is that PR already available somewhere?

jmolivas commented 6 years ago

No PR yet, @mikran

amitsharmadoj commented 6 years ago

@jmolivas looking forward to new patches for ContainerAwareCommandTrait.php and ThemeKeysCommand.php as I am facing the same issue after upgrading drupal-console to 1.8.0. I have also created patch for that but not able to upload it. Is uploading a patch for drupal-console different from any other drupal module where it accepts .diff and .patch files?

amitsharmadoj commented 6 years ago

Fix-ThemeKeysCommand-issue-3865.txt

amitsharmadoj commented 6 years ago

Patch for theme keys command issue. Created a new issue in drupal https://www.drupal.org/project/console/issues/2996310 https://www.drupal.org/files/issues/2018-08-31/Fix-ThemeKeysCommand-issue-3865.patch

amitsharmadoj commented 6 years ago

Created patch for console core but as @theodorosploumis said it is not getting applied successfully. https://www.drupal.org/files/issues/2018-08-31/Fix-ContainerAwareCommand-issue-3865_0.patch

amitsharmadoj commented 6 years ago

Fix-ContainerAwareCommand-issue-3865_0.patch is working. I was initially applying it against drupal/console rather than drupal/console-core.

prineshaz commented 5 years ago

@jmolivas any luck with this? Causing issues for us aswell, ie lots of messy looking warnings in logs.

tekNorah commented 5 years ago

Is this patch available to consume? I get 404 when I try to access them.

amitsharmadoj commented 5 years ago

@tekNorah if this is what you are looking for:

Fix JsTestCommand issue: https://github.com/hechoendrupal/drupal-console/pull/3865.patch

Fix ThemeKeysCommand issue: https://www.drupal.org/files/issues/2018-08-31/Fix-ThemeKeysCommand-issue-3865_0.patch

laradevitt commented 5 years ago

I am also seeing this. The patches in the last comment didn't resolve it.

Edit: Rolling back to Drupal Console v1.5 got rid of the error.