diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-06-21 12:21:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 12:21:32 +0200 |
commit | 53eafc0cb72717094e368813005872cd0c17f4b0 (patch) | |
tree | cd0ff148bfa2a1add0d6015e7efe89001ac516d8 /lib | |
parent | 7d0804e85cbfce277b6985852d10d5e6b0a2fd90 (diff) | |
parent | d8c419c304ad783d419f77aa03e83ee1adf23efd (diff) | |
download | nextcloud-server-53eafc0cb72717094e368813005872cd0c17f4b0.tar.gz nextcloud-server-53eafc0cb72717094e368813005872cd0c17f4b0.zip |
Merge pull request #32868 from nextcloud/fix/replace-opis-closure-by-laravel-fork
Replace opis/closure by laravel/serializable-closure
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Command/ClosureJob.php | 5 | ||||
-rw-r--r-- | lib/private/Command/CommandJob.php | 2 | ||||
-rw-r--r-- | lib/private/Command/CronBus.php | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/Command/ClosureJob.php b/lib/private/Command/ClosureJob.php index 498fe6d1d96..5639852e4db 100644 --- a/lib/private/Command/ClosureJob.php +++ b/lib/private/Command/ClosureJob.php @@ -23,10 +23,13 @@ namespace OC\Command; use OC\BackgroundJob\QueuedJob; +use Laravel\SerializableClosure\SerializableClosure as LaravelClosure; +use Opis\Closure\SerializableClosure as OpisClosure; class ClosureJob extends QueuedJob { protected function run($serializedCallable) { - $callable = \Opis\Closure\unserialize($serializedCallable); + $callable = unserialize($serializedCallable, [LaravelClosure::class, OpisClosure::class]); + $callable = $callable->getClosure(); if (is_callable($callable)) { $callable(); } else { diff --git a/lib/private/Command/CommandJob.php b/lib/private/Command/CommandJob.php index 6fa0c6d7ceb..5b267162c81 100644 --- a/lib/private/Command/CommandJob.php +++ b/lib/private/Command/CommandJob.php @@ -30,7 +30,7 @@ use OCP\Command\ICommand; */ class CommandJob extends QueuedJob { protected function run($serializedCommand) { - $command = \Opis\Closure\unserialize($serializedCommand); + $command = unserialize($serializedCommand); if ($command instanceof ICommand) { $command->handle(); } else { diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php index 89a739617d0..8749ad0bff5 100644 --- a/lib/private/Command/CronBus.php +++ b/lib/private/Command/CronBus.php @@ -26,6 +26,7 @@ namespace OC\Command; use OCP\Command\ICommand; +use Laravel\SerializableClosure\SerializableClosure; class CronBus extends AsyncBus { /** @@ -67,9 +68,9 @@ class CronBus extends AsyncBus { */ private function serializeCommand($command) { if ($command instanceof \Closure) { - return \Opis\Closure\serialize($command); + return serialize(new SerializableClosure($command)); } elseif (is_callable($command) or $command instanceof ICommand) { - return \Opis\Closure\serialize($command); + return serialize($command); } else { throw new \InvalidArgumentException('Invalid command'); } |