Drupal-console: All 'drupal' commands end with php warning

Created on 25 Feb 2018  路  26Comments  路  Source: hechoendrupal/drupal-console

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:

  • Drupal version 8.4.5
  • Console version 1.6.1
  • Console Launcher version 1.6.1
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)                           

in progress

Most helpful comment

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

  • Drupal version: 8.5.3
  • Console version: 1.8.0
  • Console launcher version: 1.8.0

All 26 comments

@justclint which OS and PHP are you using?

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

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"
        }

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

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

Same form me.

  • ubuntu 16.04
  • php5.6.34
  • apache2 2.4.18
  • drupalconsole 1.7.0

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

@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

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

any news concerning this issue?

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

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

  • Drupal version: 8.5.3
  • Console version: 1.8.0
  • Console launcher version: 1.8.0

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?

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

@jmolivas is that PR already available somewhere?

No PR yet, @mikran

@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?

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

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

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

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

@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

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

  • PHP 5.6.30
  • Drupal 8.6.4
  • Drupal Console 1.8.0
  • XAMPP/Windows 10 (10.0.17134 Build 17134) 64-bit

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

Was this page helpful?
0 / 5 - 0 ratings