Skip to content

Commit d34c8b7

Browse files
author
Marko Pavlovic
committed
Merge pull request #52 from splashlab/empty_status_enqueue
Fix for consume loop to prevent passing empty "\r\n" statuses to enqueueStatus()
2 parents 4d2df59 + 92026de commit d34c8b7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Phirehose.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ public function consume($reconnect = TRUE)
464464
//Process each full tweet inside $this->buff
465465
while(1){
466466
$eol = strpos($this->buff,"\r\n"); //Find next line ending
467+
if($eol===0) { // if 0, then buffer starts with "\r\n", so trim it and loop again
468+
$this->buff = substr($this->buff,$eol+2); // remove the "\r\n" from line start
469+
continue; // loop again
470+
}
467471
if($eol===false)break; //Time to get more data
468472
$enqueueStart = microtime(TRUE);
469473
$this->enqueueStatus(substr($this->buff,0,$eol));

0 commit comments

Comments
 (0)