From c2a7fff4f6f79e37aedf299fd01727efd9082450 Mon Sep 17 00:00:00 2001 From: Robin Appelman <icewind@owncloud.com> Date: Tue, 17 Feb 2015 16:52:09 +0100 Subject: throw an exception when trying to push a background job that wont fit in the table 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 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index 4011572f62e..95a7b125801 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -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)); } -- cgit v1.2.3