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

PHP TCompactProtocol has fails to decode messages

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.1
    • 0.9.2
    • PHP - Library
    • Tested under PHP 5.3 and HHVM latest.

    • Patch Available

    Description

      There are two typos in TCompactProtocol::readMessageBegin that prevent correct decoding of any message. They are on consecutive lines:

      https://github.com/apache/thrift/blob/master/lib/php/lib/Thrift/Protocol/TCompactProtocol.php#L390-L391

      First $seqId does not match case of argument $seqid so this is not set PHP is not case sensitive for class names but IS for variable names.

      Second and more importantly, on the following line $name has the decoded length assigned to it instead of $result. This means the method name "hello" ends up being decoded as "6" (the length of the string plus length prefix) and hence any processor trying to dispatch the event will fail.

      I can submit a patch/pull request but its only 6 chars to change and clearly there are no automated tests for this protocol implementation as that should have been caught before.

      I guess not many other people are using PHP as a thrift service processor with this protocol.

      Attachments

        Issue Links

          Activity

            People

              roger Roger Meier
              banks Paul Banks
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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