Skip to content

Commit

Permalink
Force cast json decoded failed_job_ids to array
Browse files Browse the repository at this point in the history
  • Loading branch information
naciriii committed Mar 24, 2023
1 parent 40ad58b commit 57aac3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Bus/DatabaseBatchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function decrementPendingJobs(string $batchId, string $jobId)
return [
'pending_jobs' => $batch->pending_jobs - 1,
'failed_jobs' => $batch->failed_jobs,
'failed_job_ids' => json_encode(array_values(array_diff(json_decode($batch->failed_job_ids, true), [$jobId]))),
'failed_job_ids' => json_encode(array_values(array_diff((array) json_decode($batch->failed_job_ids, true), [$jobId]))),
];
});

Expand All @@ -164,7 +164,7 @@ public function incrementFailedJobs(string $batchId, string $jobId)
return [
'pending_jobs' => $batch->pending_jobs,
'failed_jobs' => $batch->failed_jobs + 1,
'failed_job_ids' => json_encode(array_values(array_unique(array_merge(json_decode($batch->failed_job_ids, true), [$jobId])))),
'failed_job_ids' => json_encode(array_values(array_unique(array_merge((array) json_decode($batch->failed_job_ids, true), [$jobId])))),
];
});

Expand Down

0 comments on commit 57aac3a

Please sign in to comment.