This is an automated email from the ASF dual-hosted git repository.
jensg 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 64ac65e THRIFT-5199: Fix infinite loop writing to closed TSocket in
PHP Client: php Patch: Tim Heilig
64ac65e is described below
commit 64ac65ea7e0763c32d6dca988a2c779f89bece84
Author: Tim Heilig <[email protected]>
AuthorDate: Thu May 7 23:19:16 2020 -0700
THRIFT-5199: Fix infinite loop writing to closed TSocket in PHP
Client: php
Patch: Tim Heilig
This closes #2134
---
lib/php/lib/Transport/TSocket.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/php/lib/Transport/TSocket.php
b/lib/php/lib/Transport/TSocket.php
index 5147efa..374037a 100644
--- a/lib/php/lib/Transport/TSocket.php
+++ b/lib/php/lib/Transport/TSocket.php
@@ -328,7 +328,8 @@ class TSocket extends TTransport
if ($writable > 0) {
// write buffer to stream
$written = fwrite($this->handle_, $buf);
- if ($written === -1 || $written === false) {
+ $closed_socket = $written === 0 && feof($this->handle_);
+ if ($written === -1 || $written === false || $closed_socket) {
throw new TTransportException(
'TSocket: Could not write ' .
TStringFuncFactory::create()->strlen($buf) . ' bytes ' .
$this->host_ . ':' . $this->port_