Browse files

use fgets instead of fread in Stomp::readFrame()

fread reads up to specified number of bytes or EOF.
fgets reads up to "\n", number of bytes or EOF.

The problem with fread is that if there is more than one Frame
on the socket, it will read the current Frame and part of the next
Frame.  Stomp::readFrame() is expected to just read the next Frame.
  • Loading branch information...
1 parent 92265d5 commit e143d5c40b930935cf8a72da9e0a4419bc02a217 @boonedox boonedox committed Feb 20, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/FuseSource/Stomp/Stomp.php
View
2 src/FuseSource/Stomp/Stomp.php
@@ -563,7 +563,7 @@ public function readFrame ()
$end = false;
do {
- $read = fread($this->_socket, $rb);
+ $read = fgets($this->_socket, $rb);
if ($read === false || $read === "") {
$this->_reconnect();
return $this->readFrame();

0 comments on commit e143d5c

Please sign in to comment.