Skip to content

Commit a4f2380

Browse files
committed
fix issue push
1 parent bd94aa4 commit a4f2380

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Queue/CMQQueue.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,23 @@ public function size($queue = null)
8080
* Push a new job onto the queue.
8181
*
8282
* @param string|object $job
83-
* @param mixed $data
84-
* @param string $queue
83+
* @param mixed $data
84+
* @param string $queue
8585
*
8686
* @return mixed
8787
*/
8888
public function push($job, $data = '', $queue = null)
8989
{
90-
$payload = $this->isPlain() ? $job->getPayload() : $this->createPayload($job, $data);
90+
if ($this->isPlain()) {
91+
return $this->pushRaw($job->getPayload(), $queue);
92+
}
93+
94+
$reflection = new \ReflectionMethod($this, 'createPayload');
95+
if ($reflection->getNumberOfParameters() === 3) { // version >= 5.7
96+
$payload = $this->createPayload($job, $queue, $data);
97+
} else {
98+
$payload = $this->createPayload($job, $data);
99+
}
91100

92101
return $this->pushRaw($payload, $queue);
93102
}

0 commit comments

Comments
 (0)