Skip to content

Commit 054c391

Browse files
committed
Merge branch 'fix-retry-command-for-encrypted-jobs' into 8.x
2 parents e4927c1 + 2fb5e44 commit 054c391

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Illuminate/Queue/Console/RetryCommand.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
use DateTimeInterface;
66
use Illuminate\Console\Command;
7+
use Illuminate\Contracts\Encryption\Encrypter;
78
use Illuminate\Support\Arr;
9+
use Illuminate\Support\Str;
10+
use RuntimeException;
811

912
class RetryCommand extends Command
1013
{
@@ -131,7 +134,15 @@ protected function refreshRetryUntil($payload)
131134
return json_encode($payload);
132135
}
133136

134-
$instance = unserialize($payload['data']['command']);
137+
if (Str::startsWith($payload['data']['command'], 'O:')) {
138+
$instance = unserialize($payload['data']['command']);
139+
} elseif ($this->laravel->bound(Encrypter::class)) {
140+
$instance = unserialize($this->laravel->make(Encrypter::class)->decrypt($payload['data']['command']));
141+
}
142+
143+
if (! isset($instance)) {
144+
throw new RuntimeException('Unable to extract job payload.');
145+
}
135146

136147
if (is_object($instance) && method_exists($instance, 'retryUntil')) {
137148
$retryUntil = $instance->retryUntil();

0 commit comments

Comments
 (0)