[2022-07-22 17:07:29] local.WARNING: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /XXX/XXXX/XXX/XXX/myapp/vendor/laravel/horizon/src/Http/Controllers/FailedJobsController.php on line 122
(As my deprecation log was set to a null driver I got an exception for this on top.)
[2022-07-21 14:15:28] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [deprecations] is not defined. at /XXX/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:207)
Visiting the Horizon dashboard under "'/horizon/failed" will produce this warning in the deprecation log file.
It looks like the value of $job->retried_by
is just an empty array []
which leads to this warning which multiples by the amount of failed jobs.
Steps To Reproduce:
My Job is just a generic one to experiment with:
class DebugJob implements ShouldQueue
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 2;
public $backoff = [3, 5, 6]; // sec
public Domain $domain;
public function __construct(Domain $domain)
$this->domain = $domain;
public function handle()
$ip = Ip::inRandomOrder()->first();
logger("DebugJob ++++ STARTED... for IP: {$ip->id}");
if (random_int(1,5) >= 2)
throw new \Exception("DebugJob ++++ FAILED ... for IP: {$ip->id}");
logger("DebugJob ++++ FINISHED ... for IP: {$ip->id}");
config/queues.php
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 10,
'block_for' => null,
'after_commit' => false,
horizon.php
'defaults' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['setup','email','default'],
'balance' => 'auto',
'maxProcesses' => 50,
'maxTime' => 0,
'maxJobs' => 0,
'memory' => 512,
'tries' => 3, // DEFAULT can be overwritten in Job
'timeout' => 360,
'nice' => 0,
EDIT FIX:
It's basically this PHP 8.1 issue: laravel/framework#41643
Changing FailedJobsController.php#L122
FROM:
$job->retried_by = collect(json_decode($job->retried_by))
$job->retried_by = collect(json_decode((string)$job->retried_by))
If it's correct, let me know I will push a PR.
Deprecation log get blown up with json_decode() warnings
[PHP 8.1] Deprecation message from json_decode in FailedJobsController
Jul 23, 2022