laravel / tinker

Powerful REPL for the Laravel framework.
https://laravel.com/docs/artisan#tinker
MIT License
7.32k stars 130 forks source link

Can't open Tinker because of a bad $options argument to Symfony #140

Closed jcs224 closed 2 years ago

jcs224 commented 2 years ago

Description:

Can't boot Tinker in one of our environments. It must be unique to the environment, since it doesn't work with other Laravel codebases on the same server.

php artisan tinker

   TypeError 

  Symfony\Component\Console\Formatter\OutputFormatterStyle::__construct(): Argument #3 ($options) must be of type array, string given, called in /<private-folder>/test-project/vendor/psy/psysh/src/Configuration.php on line 1680

  at vendor/symfony/console/Formatter/OutputFormatterStyle.php:36
     32▕      *
     33▕      * @param string|null $foreground The style foreground color name
     34▕      * @param string|null $background The style background color name
     35▕      */
  ➜  36▕     public function __construct(string $foreground = null, string $background = null, array $options = [])
     37▕     {
     38▕         $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
     39▕     }
     40▕ 

      +20 vendor frames 
  21  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

Steps To Reproduce:

Don't know how to reproduce since it seems to be environment-specific, but not sure. Same project works everywhere else including other Ubuntu servers and Laravel Sail. It doesn't appear to be our code because we get the same issue when creating a test project and running php artisan tinker in that same environment.

I know this is difficult to reproduce but I would be grateful for any guidance, or where else I should take this issue. Maybe one of the dependencies needs fixing?

driesvints commented 2 years ago

I can't reproduce this on the latest Laravel 8.x and Tinker 2.x versions. Please run composer update and see if the issue persists.

Screenshot 2022-01-20 at 15 27 17
gleman17 commented 2 years ago

In case anyone else runs into this....

There was a file : ~/.config/psysh/config.php that was in the wrong format? Deleting this file removed the issue. Tinker was failing because it was trying to load an option as a string instead of array.