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
            Reporter: BeUKing


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 is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to