michelsalib / BCCResqueBundle

The BCC resque bundle provides integration of php-resque to Symfony2. It is inspired from resque, a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.
122 stars 91 forks source link

Scheduled worker throws error: string expected, array given #111

Closed josephdpurcell closed 10 years ago

josephdpurcell commented 10 years ago

When I start the scheduled worker like so:

$ app/console bcc:resque:scheduledworker-start
Starting worker nohup /usr/bin/php5 /var/www/vendor/bcc/resque-bundle/BCC/ResqueBundle/Command/../bin/resque-scheduler > /var/www/app/logs/resque-scheduler_dev.log 2>&1 & echo $!

I receive the following error:

PHP Warning:  strlen() expects parameter 1 to be string, array given in /var/www/vendor/colinmollenhour/credis/Client.php on line 1036
PHP Notice:  Array to string conversion in /var/www/vendor/colinmollenhour/credis/Client.php on line 1036

I don't know if this is an issue with BCC, Chris Boulton's resque-scheduler, or Colin Mollenhour's "credis" lib. I noticed in vendor/chrisboulton/php-resque-scheduler/lib/ResqueScheduler.php on line 228 it has the following:

$items = Resque::redis()->zrangebyscore('delayed_queue_schedule', '-inf', $at, array('limit' => array(0, 1)));

This then gets run through an array_map in "credis" here: https://github.com/colinmollenhour/credis/blob/master/Client.php#L1086-L1089

Which, means that $arg that gets passed to _map is array('limit' => array(0, 1)), which then the code attempts to take an strlen of it on 1036:

return sprintf('$%d%s%s', strlen($arg), CRLF, $arg);

I'm using PHP 5.5.9.

Any suggestions on what I should do / where I should go to contribute a fix?

josephdpurcell commented 10 years ago

I'm now wondering if this is a duplicate of: https://github.com/michelsalib/BCCResqueBundle/issues/82

josephdpurcell commented 10 years ago

It looks like this is in fact a duplicate of #82.

The cause was I didn't have php-redis installed. I'm on Ubuntu 14.04 so my fix was:

sudo apt-get install php5-redis

Closing this issue.