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

PHP TCompactProtocol bool&int64 readvalue bug

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.2
    • 0.10.0
    • PHP - Library
    • None
    • osx 10.10.5, php 5.5.27, python 2.7.10 thrift 0.9.2 , install by brew. 64 bit machines

    • Patch Available

    Description

      create a thrift file like

       namespace php demo
       namesapce py demo
       struct obj{
           1:required i64 int64,
           2:required bool bol,
       }
       service Demo {
           obj trans(1:obj item),
       }
      

      protocol use TCompactProtocol
      server is python, client is php
      client call trans func with
      i64(-1)
      bool(true)
      and print the server response
      the output is

      object(demo\obj)#8 (2) {
        ["int64"]=>
        float(1.844674407371E+19)
        ["bol"]=>
        bool(false)
      }
      

      Attachments

        Issue Links

          Activity

            githubbot ASF GitHub Bot added a comment -

            GitHub user zhaakhi opened a pull request:

            https://github.com/apache/thrift/pull/1132

            THRIFT-3348 PHP TCompactProtocol bool&int64 readvalue bug

            TCompactProtocol always serializes boolean struct values as false, due
            to a confusion between the internal compact type field representation
            and the normal Thrift types.

            There is also a slight mishandling of i64 values where -2^63 will
            overflow and be converted to a float, even though it is representable as
            a 64-bit int.

            You can merge this pull request into a Git repository by running:

            $ git pull https://github.com/zhaakhi/thrift THRIFT-3348

            Alternatively you can review and apply these changes as the patch at:

            https://github.com/apache/thrift/pull/1132.patch

            To close this pull request, make a commit to your master/trunk branch
            with (at least) the following in the commit message:

            This closes #1132


            commit f6a0fb0480aa3fc2d6b69dd676b219cdf7b3e9a0
            Author: Håkon Hitland <hakon.hitland@zedge.net>
            Date: 2016-11-17T15:59:30Z

            THRIFT-3348 PHP TCompactProtocol bool&int64 readvalue bug

            TCompactProtocol always serializes boolean struct values as false, due
            to a confusion between the internal compact type field representation
            and the normal Thrift types.

            There is also a slight mishandling of i64 values where -2^63 will
            overflow and be converted to a float, even though it is representable as
            a 64-bit int.


            githubbot ASF GitHub Bot added a comment - GitHub user zhaakhi opened a pull request: https://github.com/apache/thrift/pull/1132 THRIFT-3348 PHP TCompactProtocol bool&int64 readvalue bug TCompactProtocol always serializes boolean struct values as false, due to a confusion between the internal compact type field representation and the normal Thrift types. There is also a slight mishandling of i64 values where -2^63 will overflow and be converted to a float, even though it is representable as a 64-bit int. You can merge this pull request into a Git repository by running: $ git pull https://github.com/zhaakhi/thrift THRIFT-3348 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/1132.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1132 commit f6a0fb0480aa3fc2d6b69dd676b219cdf7b3e9a0 Author: Håkon Hitland <hakon.hitland@zedge.net> Date: 2016-11-17T15:59:30Z THRIFT-3348 PHP TCompactProtocol bool&int64 readvalue bug TCompactProtocol always serializes boolean struct values as false, due to a confusion between the internal compact type field representation and the normal Thrift types. There is also a slight mishandling of i64 values where -2^63 will overflow and be converted to a float, even though it is representable as a 64-bit int.
            githubbot ASF GitHub Bot added a comment -

            Github user asfgit closed the pull request at:

            https://github.com/apache/thrift/pull/1132

            githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/thrift/pull/1132
            jensg Jens Geyer added a comment -

            Committed, thanks!

            jensg Jens Geyer added a comment - Committed, thanks!
            barrylb Barry Brannan added a comment -

            this should also resolve THRIFT-1548

            barrylb Barry Brannan added a comment - this should also resolve THRIFT-1548

            People

              hakon Håkon Hitland
              Saerdna Dahao.Saerdna.Zhao
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 4h
                  4h
                  Remaining:
                  Remaining Estimate - 4h
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified