laravel/tinker

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

jcs224 opened this issue · 2 comments

  • Tinker Version: 2.6.3
  • Laravel Version: 8.73.2
  • PHP Version: 8.0.12
  • Database Driver & Version: MySQL 8.0.27-0ubuntu20.04.1

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?

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

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.