Paul Banks created THRIFT-2351:
----------------------------------

             Summary: PHP TCompactProtocol has fails to decode messages
                 Key: THRIFT-2351
                 URL: https://issues.apache.org/jira/browse/THRIFT-2351
             Project: Thrift
          Issue Type: Bug
          Components: PHP - Library
    Affects Versions: 0.9.1
         Environment: Tested under PHP 5.3 and HHVM latest.
            Reporter: Paul Banks


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.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to