You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Ashenp (JIRA)" <ji...@apache.org> on 2017/12/05 08:40:00 UTC

[jira] [Commented] (THRIFT-4407) Something wrong with the data structure [set] with the php lib

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

Ashenp commented on THRIFT-4407:
--------------------------------

I Found it  in function _writeList in TBase.php

   
{code:php}
 foreach ($var as $key => $val) {
      $elem = $set ? $key : $val;
      if (isset($ewrite)) {
        $xfer += $output->$ewrite($elem);
      } else {
        switch ($etype) {
        case TType::STRUCT:
          $xfer += $elem->write($output);
          break;
        case TType::MAP:
          $xfer += $this->_writeMap($elem, $espec, $output);
          break;
        case TType::LST:
          $xfer += $this->_writeList($elem, $espec, $output, false);
          break;
        case TType::SET:
          $xfer += $this->_writeList($elem, $espec, $output, true);
          break;
        }
      }
    }
{code}



Why thrift treat Set as List and only consider the Key in that Array? 

> Something wrong with the data structure [set] with the php lib
> --------------------------------------------------------------
>
>                 Key: THRIFT-4407
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4407
>             Project: Thrift
>          Issue Type: Bug
>          Components: PHP - Library
>    Affects Versions: 0.10.0
>         Environment: CentOS 6.5
>            Reporter: Ashenp
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> The function in thrift file:
> set<string> set_test(1:set<string> test_set)
> My test is like this:
> $s = new Bd_Wrpc_Client("arch.soa_test");
>         $res9 = $s->set_test(
>             array("ww","qq")
>             );
> and My server supposed to return whatever I passed.
> But I got the wring answer:
> array(2) { [0]=> bool(true) [1]=> bool(true) }
> Is there a bug in Thrift php lib? 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)