]> source.dussan.org Git - nextcloud-server.git/commitdiff
throw an exception when trying to push a background job that wont fit in the table
authorRobin Appelman <icewind@owncloud.com>
Tue, 17 Feb 2015 15:52:09 +0000 (16:52 +0100)
committerRobin Appelman <icewind@owncloud.com>
Wed, 25 Feb 2015 14:08:40 +0000 (15:08 +0100)
otherwise it will lead to failures in json decode and unexpected and hard to debug issues when running the job

lib/private/backgroundjob/joblist.php

index 4011572f62e5d65bb61cf193686f0dde405c06b3..95a7b1258010af913356fa94e0ec9a79e0c57010 100644 (file)
@@ -57,6 +57,9 @@ class JobList implements IJobList {
                                $class = $job;
                        }
                        $argument = json_encode($argument);
+                       if (strlen($argument) > 2048) {
+                               throw new \InvalidArgumentException('Background job arguments cant exceed 2048 characters (json encoded');
+                       }
                        $query = $this->conn->prepare('INSERT INTO `*PREFIX*jobs`(`class`, `argument`, `last_run`) VALUES(?, ?, 0)');
                        $query->execute(array($class, $argument));
                }