From 9d041f43608def3850da05b56b75495bdf9ad22a Mon Sep 17 00:00:00 2001 From: Kirill Berezin Date: Fri, 23 Sep 2016 07:23:26 +0300 Subject: [PATCH] Do not flash huge frames in nonblock mode --- lib/Base.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Base.php b/lib/Base.php index 59e8047..0f6f48d 100644 --- a/lib/Base.php +++ b/lib/Base.php @@ -12,7 +12,7 @@ class Base { protected $socket, $is_connected = false, $is_closing = false, $last_opcode = null, - $close_status = null, $huge_payload = null; + $close_status = null, $huge_payload = ''; protected static $opcodes = array( 'continuation' => 0, @@ -137,8 +137,6 @@ protected function send_fragment($final, $payload, $opcode, $masked) { public function receive($try = false) { if (!$this->is_connected) $this->connect(); /// @todo This is a client function, fixme! - $this->huge_payload = ''; - $response = null; do { $response = $this->receive_fragment(); @@ -285,7 +283,7 @@ protected function receive_fragment() { else if ($this->huge_payload) { // sp we need to retreive the whole payload $payload = $this->huge_payload .= $payload; - $this->huge_payload = null; + $this->huge_payload = ''; } return $payload;