Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1086

PHP client return wrong value when connect to Java Thrift Service

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            beuking BeUKing
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: