From 43b9343418999b7f379b81e6aaea7983aa1e698d Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 13 Apr 2014 12:32:50 -0400 Subject: [PATCH] [stream] Don't emit data if empty. Replaced py test with php --- Connection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Connection.php b/Connection.php index 2806bab4..63d2e583 100644 --- a/Connection.php +++ b/Connection.php @@ -11,9 +11,10 @@ public function handleData($stream) // Socket is raw, not using fread as it's interceptable by filters // See issues #192, #209, and #240 $data = stream_socket_recvfrom($stream, $this->bufferSize); - if( '' !== $data || false !== $data ){ + if ('' !== $data && false !== $data) { $this->emit('data', array($data, $this)); } + if ('' === $data || false === $data || feof($stream)) { $this->end(); }