laravel / lumen-framework

The Laravel Lumen Framework.
https://lumen.laravel.com
MIT License
1.48k stars 419 forks source link

unserialize(): Error at offset 11 of 253 bytes when using anonymous class in queue #1127

Closed foremtehan closed 3 years ago

foremtehan commented 3 years ago

Since lumen doesnt support closure jobs i used inline anonumous class :

$class = new class extends \App\Jobs\Job {
    public function handle()
    {
        //
    }
};

dispatch($class);

But i get error :

ErrorException: unserialize(): Error at offset 11 of 253 bytes in /app/vendor/illuminate/queue/CallQueuedHandler.php:53
Stack trace:
#0 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
#1 /app/vendor/illuminate/queue/CallQueuedHandler.php(53): unserialize()
#2 /app/vendor/illuminate/queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#3 /app/vendor/illuminate/queue/Worker.php(356): Illuminate\Queue\Jobs\Job->fire()
#4 /app/vendor/illuminate/queue/Worker.php(306): Illuminate\Queue\Worker->process()
#5 /app/vendor/illuminate/queue/Worker.php(132): Illuminate\Queue\Worker->runJob()
#6 /app/vendor/illuminate/queue/Console/WorkCommand.php(112): Illuminate\Queue\Worker->daemon()
#7 /app/vendor/illuminate/queue/Console/WorkCommand.php(96): Illuminate\Queue\Console\WorkCommand->runWorker()
#8 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#9 /app/vendor/illuminate/container/BoundMethod.php(37): call_user_func_array()
#10 /app/vendor/illuminate/container/Util.php(37): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#11 /app/vendor/illuminate/container/BoundMethod.php(95): Illuminate\Container\Util::unwrapIfClosure()
#12 /app/vendor/illuminate/container/BoundMethod.php(39): Illuminate\Container\BoundMethod::callBoundMethod()
#13 /app/vendor/illuminate/container/Container.php(596): Illuminate\Container\BoundMethod::call()
#14 /app/vendor/illuminate/console/Command.php(134): Illuminate\Container\Container->call()
#15 /app/vendor/symfony/console/Command/Command.php(258): Illuminate\Console\Command->execute()
#16 /app/vendor/illuminate/console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#17 /app/vendor/symfony/console/Application.php(920): Illuminate\Console\Command->run()
#18 /app/vendor/symfony/console/Application.php(266): Symfony\Component\Console\Application->doRunCommand()
#19 /app/vendor/symfony/console/Application.php(142): Symfony\Component\Console\Application->doRun()
#20 /app/vendor/illuminate/console/Application.php(93): Symfony\Component\Console\Application->run()
#21 /app/vendor/laravel/lumen-framework/src/Console/Kernel.php(116): Illuminate\Console\Application->run()
#22 /app/artisan(35): Laravel\Lumen\Console\Kernel->handle()
#23 {main}
driesvints commented 3 years ago

Hey there,

Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? We'll help you out and re-open this issue if so.

Thanks!