From: Mark Slee Date: Thu, 28 Sep 2006 03:19:03 +0000 (+0000) Subject: Check for empty buf on socket read X-Git-Tag: 0.2.0~1663 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=29f5f67e1fafdd9ef263b59f2d93c347d2209c44;p=common%2Fthrift.git Check for empty buf on socket read git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664809 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/php/src/transport/TSocket.php b/lib/php/src/transport/TSocket.php index 5ecd8740..5ca23e72 100644 --- a/lib/php/src/transport/TSocket.php +++ b/lib/php/src/transport/TSocket.php @@ -169,9 +169,9 @@ class TSocket extends TTransport { // $buf = @stream_get_contents($this->handle_, $len); $pre = null; - while (true) { + while (TRUE) { $buf = @fread($this->handle_, $len); - if ($buf === FALSE) { + if (!$buf) { throw new Exception('TSocket: Could not read '.$len.' bytes from '. $this->host_.':'.$this->port_); } else if (($sz = strlen($buf)) < $len) {