thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4656) infinite loop in latest PHP library
Date Wed, 05 Dec 2018 21:08:00 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16710636#comment-16710636
] 

ASF GitHub Bot commented on THRIFT-4656:
----------------------------------------

jeking3 closed pull request #1618: THRIFT-4656: Fix infinite loop in PHP TCurlClient
URL: https://github.com/apache/thrift/pull/1618
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/php/lib/Transport/TCurlClient.php b/lib/php/lib/Transport/TCurlClient.php
index 3d4908d901..482b43b72c 100644
--- a/lib/php/lib/Transport/TCurlClient.php
+++ b/lib/php/lib/Transport/TCurlClient.php
@@ -169,6 +169,24 @@ public function read($len)
         }
     }
 
+    /**
+     * 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
      *


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> infinite loop in latest PHP library
> -----------------------------------
>
>                 Key: THRIFT-4656
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4656
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>            Reporter: Josip Sokcevic
>            Priority: Major
>             Fix For: 0.12.0
>
>         Attachments: 0001-THRIFT-4656-Fix-infinite-loop-in-PHP-TCurlClient.patch
>
>
> The latest PHP library can enter into infinite loop state when specific payload is returned:
> HTTP status: 200
> Response body: <empty>
>  
> It was introduced with THRIFT-4645, where check was replaced from
> {code:java}
> !$this->response_{code}
> to
> {code:java}
> $this->response_ === false{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message