title: Uncaught TTransportException' with message 'THttpClient: Could not read 1936027957 bytes in THttpClient.php:162
body: <p>This is my thrift definition </p>
  
  <pre><code>namespace php mobiledata
  
  struct sms
  {
      1: string from,
      2: string to,
      3: string smstext,
      4: string smsdatetime,
      5: string smsdirection
  }
  
  struct smsdetails
  {
      1: list&lt;sms&gt; smsdata
  }
  
  service mobiledataservice
  {
      void insertsmsdata (1: smsdetails smslist)
  }
  </code></pre>
  
  <p>The php type generated by the thrift in Types.php is </p>
  
  <pre><code>&lt;?php
  namespace mobiledata;
  
  /**
   * Autogenerated by Thrift Compiler (1.0.0-dev)
   *
   * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
   *  @generated
   */
  use Thrift\Base\TBase;
  use Thrift\Type\TType;
  use Thrift\Type\TMessageType;
  use Thrift\Exception\TException;
  use Thrift\Exception\TProtocolException;
  use Thrift\Protocol\TProtocol;
  use Thrift\Protocol\TBinaryProtocolAccelerated;
  use Thrift\Exception\TApplicationException;
  
  
  class sms {
    static $_TSPEC;
  
    /**
     * @var string
     */
    public $from = null;
    /**
     * @var string
     */
    public $to = null;
    /**
     * @var string
     */
    public $smstext = null;
    /**
     * @var string
     */
    public $smsdatetime = null;
    /**
     * @var string
     */
    public $smsdirection = null;
  
    public function __construct($vals=null) {
      if (!isset(self::$_TSPEC)) {
        self::$_TSPEC = array(
          1 =&gt; array(
            'var' =&gt; 'from',
            'type' =&gt; TType::STRING,
            ),
          2 =&gt; array(
            'var' =&gt; 'to',
            'type' =&gt; TType::STRING,
            ),
          3 =&gt; array(
            'var' =&gt; 'smstext',
            'type' =&gt; TType::STRING,
            ),
          4 =&gt; array(
            'var' =&gt; 'smsdatetime',
            'type' =&gt; TType::STRING,
            ),
          5 =&gt; array(
            'var' =&gt; 'smsdirection',
            'type' =&gt; TType::STRING,
            ),
          );
      }
      if (is_array($vals)) {
        if (isset($vals['from'])) {
          $this-&gt;from = $vals['from'];
        }
        if (isset($vals['to'])) {
          $this-&gt;to = $vals['to'];
        }
        if (isset($vals['smstext'])) {
          $this-&gt;smstext = $vals['smstext'];
        }
        if (isset($vals['smsdatetime'])) {
          $this-&gt;smsdatetime = $vals['smsdatetime'];
        }
        if (isset($vals['smsdirection'])) {
          $this-&gt;smsdirection = $vals['smsdirection'];
        }
      }
    }
  
    public function getName() {
      return 'sms';
    }
  
    public function read($input)
    {
      $xfer = 0;
      $fname = null;
      $ftype = 0;
      $fid = 0;
      $xfer += $input-&gt;readStructBegin($fname);
      while (true)
      {
        $xfer += $input-&gt;readFieldBegin($fname, $ftype, $fid);
        if ($ftype == TType::STOP) {
          break;
        }
        switch ($fid)
        {
          case 1:
            if ($ftype == TType::STRING) {
              $xfer += $input-&gt;readString($this-&gt;from);
            } else {
              $xfer += $input-&gt;skip($ftype);
            }
            break;
          case 2:
            if ($ftype == TType::STRING) {
              $xfer += $input-&gt;readString($this-&gt;to);
            } else {
              $xfer += $input-&gt;skip($ftype);
            }
            break;
          case 3:
            if ($ftype == TType::STRING) {
              $xfer += $input-&gt;readString($this-&gt;smstext);
            } else {
              $xfer += $input-&gt;skip($ftype);
            }
            break;
          case 4:
            if ($ftype == TType::STRING) {
              $xfer += $input-&gt;readString($this-&gt;smsdatetime);
            } else {
              $xfer += $input-&gt;skip($ftype);
            }
            break;
          case 5:
            if ($ftype == TType::STRING) {
              $xfer += $input-&gt;readString($this-&gt;smsdirection);
            } else {
              $xfer += $input-&gt;skip($ftype);
            }
            break;
          default:
            $xfer += $input-&gt;skip($ftype);
            break;
        }
        $xfer += $input-&gt;readFieldEnd();
      }
      $xfer += $input-&gt;readStructEnd();
      return $xfer;
    }
  
    public function write($output) {
      $xfer = 0;
      $xfer += $output-&gt;writeStructBegin('sms');
      if ($this-&gt;from !== null) {
        $xfer += $output-&gt;writeFieldBegin('from', TType::STRING, 1);
        $xfer += $output-&gt;writeString($this-&gt;from);
        $xfer += $output-&gt;writeFieldEnd();
      }
      if ($this-&gt;to !== null) {
        $xfer += $output-&gt;writeFieldBegin('to', TType::STRING, 2);
        $xfer += $output-&gt;writeString($this-&gt;to);
        $xfer += $output-&gt;writeFieldEnd();
      }
      if ($this-&gt;smstext !== null) {
        $xfer += $output-&gt;writeFieldBegin('smstext', TType::STRING, 3);
        $xfer += $output-&gt;writeString($this-&gt;smstext);
        $xfer += $output-&gt;writeFieldEnd();
      }
      if ($this-&gt;smsdatetime !== null) {
        $xfer += $output-&gt;writeFieldBegin('smsdatetime', TType::STRING, 4);
        $xfer += $output-&gt;writeString($this-&gt;smsdatetime);
        $xfer += $output-&gt;writeFieldEnd();
      }
      if ($this-&gt;smsdirection !== null) {
        $xfer += $output-&gt;writeFieldBegin('smsdirection', TType::STRING, 5);
        $xfer += $output-&gt;writeString($this-&gt;smsdirection);
        $xfer += $output-&gt;writeFieldEnd();
      }
      $xfer += $output-&gt;writeFieldStop();
      $xfer += $output-&gt;writeStructEnd();
      return $xfer;
    }
  
  }
  
  class smsdetails {
    static $_TSPEC;
  
    /**
     * @var \mobiledata\sms[]
     */
    public $smsdata = null;
  
    public function __construct($vals=null) {
      if (!isset(self::$_TSPEC)) {
        self::$_TSPEC = array(
          1 =&gt; array(
            'var' =&gt; 'smsdata',
            'type' =&gt; TType::LST,
            'etype' =&gt; TType::STRUCT,
            'elem' =&gt; array(
              'type' =&gt; TType::STRUCT,
              'class' =&gt; '\mobiledata\sms',
              ),
            ),
          );
      }
      if (is_array($vals)) {
        if (isset($vals['smsdata'])) {
          $this-&gt;smsdata = $vals['smsdata'];
        }
      }
    }
  
    public function getName() {
      return 'smsdetails';
    }
  
    public function read($input)
    {
      $xfer = 0;
      $fname = null;
      $ftype = 0;
      $fid = 0;
      $xfer += $input-&gt;readStructBegin($fname);
      while (true)
      {
        $xfer += $input-&gt;readFieldBegin($fname, $ftype, $fid);
        if ($ftype == TType::STOP) {
          break;
        }
        switch ($fid)
        {
          case 1:
            if ($ftype == TType::LST) {
              $this-&gt;smsdata = array();
              $_size0 = 0;
              $_etype3 = 0;
              $xfer += $input-&gt;readListBegin($_etype3, $_size0);
              for ($_i4 = 0; $_i4 &lt; $_size0; ++$_i4)
              {
                $elem5 = null;
                $elem5 = new \mobiledata\sms();
                $xfer += $elem5-&gt;read($input);
                $this-&gt;smsdata []= $elem5;
              }
              $xfer += $input-&gt;readListEnd();
            } else {
              $xfer += $input-&gt;skip($ftype);
            }
            break;
          default:
            $xfer += $input-&gt;skip($ftype);
            break;
        }
        $xfer += $input-&gt;readFieldEnd();
      }
      $xfer += $input-&gt;readStructEnd();
      return $xfer;
    }
  
    public function write($output) {
      $xfer = 0;
      $xfer += $output-&gt;writeStructBegin('smsdetails');
      if ($this-&gt;smsdata !== null) {
        if (!is_array($this-&gt;smsdata)) {
          throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
        }
        $xfer += $output-&gt;writeFieldBegin('smsdata', TType::LST, 1);
        {
          $output-&gt;writeListBegin(TType::STRUCT, count($this-&gt;smsdata));
          {
            foreach ($this-&gt;smsdata as $iter6)
            {
              $xfer += $iter6-&gt;write($output);
            }
          }
          $output-&gt;writeListEnd();
        }
        $xfer += $output-&gt;writeFieldEnd();
      }
      $xfer += $output-&gt;writeFieldStop();
      $xfer += $output-&gt;writeStructEnd();
      return $xfer;
    }
  
  }
  </code></pre>
  
  <p>In the client I am sending the data by making objects like </p>
  
  <pre><code>  $transport-&gt;open();
  
  $smsobj = new sms();
  $smsobj-&gt;from = "9999074909";
  $smsobj-&gt;to = "9999074909";
  $smsobj-&gt;smstext = "hello brij";
  $smsobj-&gt;smsdatetime = "today";
  $smsobj-&gt;smsdirection = "I";
  
  $smsdetailsobj  = new smsdetails();
  $smsdetailsobj-&gt;smsdata = array($smsobj);
  
  var_dump(array($smsobj));
  
  $client-&gt;insertsmsdata($smsdetailsobj);
  
    $transport-&gt;close();
  </code></pre>
  
  <p>I get this error when I run the client </p>
  
  <pre><code>PHP Fatal error:  Uncaught exception 'Thrift\Exception\TTransportException' with message 'THttpClient: Could not read 1936027957 bytes from localhost:80/phpserver/php-server.php' in thrift/thrift/lib/php/lib/Thrift/Transport/THttpClient.php:162
  Stack trace:
  </code></pre>
  
  <p>Looks like I am not making my php client object right, is this how i should make a list of struct objects with php - like array of objects of sms type.</p>