Friday, January 28, 2022

[FIXED] TypeError on any artisan commands

Issue

  • Laravel Version: 7.23.0
  • PHP Version: 7.4.8
  • Database Driver & Version: MySQL v8.0.21

This morning I upgraded Laravel to version 7.23.0 due to the current vulnerability (https://blog.laravel.com/laravel-cookie-security-releases). But now I get the following error message with every Artisan Command:

php artisan package:discover --ansi

   TypeError 

  Illuminate\Container\Container::bind(): Argument #2 ($concrete) must be of type Closure|string|null

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:238
    234|         // bound into this container to the abstract type and we will just wrap it
    235|         // up inside its own Closure to give us more convenience when extending.
    236|         if (! $concrete instanceof Closure) {
    237|             if (! is_string($concrete)) {
  > 238|                 throw new \TypeError(self::class.'::bind(): Argument #2 ($concrete) must be of type Closure|string|null');
    239|             }
    240| 
    241|             $concrete = $this->getClosure($abstract, $concrete);
    242|         }

      +11 vendor frames 
  12  [internal]:0
      Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Facade\Ignition\IgnitionServiceProvider))

      +5 vendor frames 
  18  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Since I think this would be a more noticeable bug, and I haven't found an issue on GitHub, I didn't open a new one and ask for help here :)

However, I don't really have any idea what exactly might be causing the problem.


Solution

Thanks to Abdel-aziz hassan for the link (https://github.com/laravel/framework/pull/33539).

I found out that facade/ignition was on an old version. I updated it and now it works.

Thanks guys!



Answered By - Florian Falk

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.