davidpersson/beanstalk — pull request #6 by socialping (2013-03-04 09:00:18+00:00)
Title: stream_get_line bug

We encountered a bug using stream_get_line where when doing very fast loops, it would get stuck waiting and the loop would stop. In our case, we had the need to empty queues, and would do a `$job = $beanstalk->reserve(1);` followed immediately by a `$beanstalk->delete($job['id']);` until the queue was empty.

fgets+trim may be slightly slower, but it fixed the issue for us.

Server Details:
PHP 5.3.3 (cli)
Linux 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64