This is an automated email from the ASF dual-hosted git repository. jking pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push: new 30d3125 THRIFT-4656: Fix infinite loop in PHP TCurlClient 30d3125 is described below commit 30d3125cc277b6e42034d5ac72fd3e5f248f353a Author: Josip Sokcevic <i...@sokac.net> AuthorDate: Tue Oct 30 15:20:26 2018 -0700 THRIFT-4656: Fix infinite loop in PHP TCurlClient Infinite loop happens when response body is empty and HTTP status is 200. This patch fixes it. --- lib/php/lib/Transport/TCurlClient.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/php/lib/Transport/TCurlClient.php b/lib/php/lib/Transport/TCurlClient.php index 3d4908d..482b43b 100644 --- a/lib/php/lib/Transport/TCurlClient.php +++ b/lib/php/lib/Transport/TCurlClient.php @@ -170,6 +170,24 @@ class TCurlClient extends TTransport } /** + * Guarantees that the full amount of data is read. Since TCurlClient gets entire payload at + * once, parent readAll cannot be used. + * + * @return string The data, of exact length + * @throws TTransportException if cannot read data + */ + public function readAll($len) + { + $data = $this->read($len); + + if (TStringFuncFactory::create()->strlen($data) !== $len) { + throw new TTransportException('TCurlClient could not read '.$len.' bytes'); + } + + return $data; + } + + /** * Writes some data into the pending buffer * * @param string $buf The data to write