You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King III (JIRA)" <ji...@apache.org> on 2019/01/26 14:08:02 UTC

[jira] [Updated] (THRIFT-1086) PHP client return wrong value when connect to Java Thrift Service

     [ https://issues.apache.org/jira/browse/THRIFT-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James E. King III updated THRIFT-1086:
--------------------------------------
    Affects Version/s:     (was: 1.0)

This issue was marked as affecting version 1.0 which is not possible.   If you know which version this issue was discovered in, please mark it as such.

> PHP client return wrong value when connect to Java Thrift Service 
> ------------------------------------------------------------------
>
>                 Key: THRIFT-1086
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1086
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Library, PHP - Library
>            Reporter: BeUKing
>            Priority: Major
>
> My Java Serivce implement thrift: 
> i32 get_point(1:required i32 userId)
> When use PHP to connect to my service, sometimes, PHP get wrong value (Java client always return right value)
> Here is my PHP code: 
> Declare client: 
>     $this->socket = new TSocket($this->_host, $this->_port, true);
>     $this->transport = new TFramedTransport($this->socket);
>     $this->protocol = new TBinaryProtocolAccelerated($this->transport);
>     $this->client = new ServiceReadClient($this->protocol);
> Declare method
> private function openTransport()
> {
>     if(!$this->transport->isOpen()){
>         $this->transport->open();
>     }
> }	
> private function closeTransport()
> {
>     if($this->transport->isOpen()){
>         $this->transport->close();
>     }
> }
> public function get_point($userId)
> {
>     $this->openTransport();
>     try 
>     {
>         $data = $this->client->get_points($userId);
>     } 
>     catch (Exception $e) 
>     {
>         $this->closeTransport();
>         return array ();
>     }
>     return $data;
> }
> -----------------------------
> When I change my thrift to
> struct Point{
>     1:required i32 point
> }
> Point get_jpoint(1:required i32 userId)
> Result: PHP client always return correct value.
> -----------------------------
> I think that is a bug of thrift. 



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