|  | 
| 5 | 5 | use Google\Cloud\Tasks\V2\CloudTasksClient; | 
| 6 | 6 | use Google\Cloud\Tasks\V2\RetryConfig; | 
| 7 | 7 | use Illuminate\Bus\Queueable; | 
|  | 8 | +use Illuminate\Contracts\Encryption\Encrypter; | 
| 8 | 9 | use Illuminate\Queue\Jobs\Job; | 
| 9 | 10 | use Illuminate\Queue\WorkerOptions; | 
|  | 11 | +use Illuminate\Support\Str; | 
| 10 | 12 | use stdClass; | 
| 11 | 13 | use UnexpectedValueException; | 
| 12 | 14 | use function Safe\json_decode; | 
| @@ -56,8 +58,8 @@ private function loadQueueConnectionConfiguration(array $task): void | 
| 56 | 58 |         /** | 
| 57 | 59 |          * @var stdClass $command | 
| 58 | 60 |          */ | 
| 59 |  | -        $command = unserialize($task['data']['command']); | 
| 60 |  | -        $connection = $command->connection ?? config('queue.default'); | 
|  | 61 | +        $command = self::getCommandProperties($task['data']['command']); | 
|  | 62 | +        $connection = $command['connection'] ?? config('queue.default'); | 
| 61 | 63 |         $this->config = array_merge( | 
| 62 | 64 |             (array) config("queue.connections.{$connection}"), | 
| 63 | 65 |             ['connection' => $connection] | 
| @@ -131,4 +133,17 @@ private function loadQueueRetryConfig(CloudTasksJob $job): void | 
| 131 | 133 | 
 | 
| 132 | 134 |         $this->retryConfig = CloudTasksApi::getRetryConfig($queueName); | 
| 133 | 135 |     } | 
|  | 136 | + | 
|  | 137 | +    public static function getCommandProperties(string $command): array | 
|  | 138 | +    { | 
|  | 139 | +        if (Str::startsWith($command, 'O:')) { | 
|  | 140 | +            return (array) unserialize($command, ['allowed_classes' => false]); | 
|  | 141 | +        } | 
|  | 142 | + | 
|  | 143 | +        if (app()->bound(Encrypter::class)) { | 
|  | 144 | +            return (array) unserialize(app(Encrypter::class)->decrypt($command), ['allowed_classes' => false]); | 
|  | 145 | +        } | 
|  | 146 | + | 
|  | 147 | +        return []; | 
|  | 148 | +    } | 
| 134 | 149 | } | 
0 commit comments