I have a third party package that uses a closure in its configuration (dingo/api), unfortunately that prevents me from using the config:cache
command as this crashes the whole application with no friendly error message nor way to recover from it besides manually deleting the config cache:
PHP Fatal error: Call to undefined method Closure::__set_state() in /Users/anahkiasen/config-closures/bootstrap/cache/config.php on line 22
PHP Stack trace:
PHP 1. {main}() /Users/anahkiasen/config-closures/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /Users/anahkiasen/config-closures/artisan:36
PHP 3. Illuminate\Foundation\Console\Kernel->bootstrap() /Users/anahkiasen/config-closures/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:96
PHP 4. Illuminate\Foundation\Application->bootstrapWith() /Users/anahkiasen/config-closures/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:196
PHP 5. Illuminate\Foundation\Bootstrap\LoadConfiguration->bootstrap() /Users/anahkiasen/config-closures/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
PHP 6. require() /Users/anahkiasen/config-closures/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php:27
Fatal error: Call to undefined method Closure::__set_state() in /Users/anahkiasen/config-closures/bootstrap/cache/config.php on line 22
And the faulty part in the cached configuration file:
array (
'oauth' =>
Closure::__set_state(array(
)),
),
Shouldn't Laravel leverage serializable closures here?
This has come up before. We don't support closures on purpose because the overhead of unserializing is greater than anything gained otherwise.
Any config system that contain closures is badly designed.
Any solution to this ? config:cache is unusable right now
Most helpful comment
Any solution to this ? config:cache is unusable right now