Merge pull request #268 from nazo/master

return false if `json_encode()` failed.
This commit is contained in:
Chris Boulton 2016-08-15 18:38:16 -07:00 committed by GitHub
commit be9ef1b92b

View File

@ -101,8 +101,12 @@ class Resque
*/ */
public static function push($queue, $item) public static function push($queue, $item)
{ {
$encodedItem = json_encode($item);
if ($encodedItem === false) {
return false;
}
self::redis()->sadd('queues', $queue); self::redis()->sadd('queues', $queue);
$length = self::redis()->rpush('queue:' . $queue, json_encode($item)); $length = self::redis()->rpush('queue:' . $queue, $encodedItem);
if ($length < 1) { if ($length < 1) {
return false; return false;
} }