aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/command/queuebus.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/command/queuebus.php')
-rw-r--r--lib/private/command/queuebus.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/command/queuebus.php b/lib/private/command/queuebus.php
index ac69f8b0d55..76caf76a575 100644
--- a/lib/private/command/queuebus.php
+++ b/lib/private/command/queuebus.php
@@ -28,7 +28,7 @@ class QueueBus implements IBus {
/**
* @var (ICommand|callable)[]
*/
- private $queue;
+ private $queue = [];
/**
* Schedule a command to be fired
@@ -52,7 +52,13 @@ class QueueBus implements IBus {
*/
private function runCommand($command) {
if ($command instanceof ICommand) {
- $command->handle();
+ // ensure the command can be serialized
+ $serialized = serialize($command);
+ if(strlen($serialized) > 4000) {
+ throw new \InvalidArgumentException('Trying to push a command which serialized form can not be stored in the database (>4000 character)');
+ }
+ $unserialized = unserialize($serialized);
+ $unserialized->handle();
} else {
$command();
}