You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2011/10/07 02:17:25 UTC

svn commit: r1179907 - /thrift/trunk/lib/php/src/protocol/TProtocol.php

Author: jfarrell
Date: Fri Oct  7 00:17:25 2011
New Revision: 1179907

URL: http://svn.apache.org/viewvc?rev=1179907&view=rev
Log:
Thrift-1377: abort PHP deserialization on unknown field type
client: php
Patch: Dave Watson

Previously the code incorrectly ignored unknown field types. After
reading the field header, if it was an unknown type it would incorrectly
assume there was no data, and start trying to read the next field
immediately. 


Modified:
    thrift/trunk/lib/php/src/protocol/TProtocol.php

Modified: thrift/trunk/lib/php/src/protocol/TProtocol.php
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/php/src/protocol/TProtocol.php?rev=1179907&r1=1179906&r2=1179907&view=diff
==============================================================================
--- thrift/trunk/lib/php/src/protocol/TProtocol.php (original)
+++ thrift/trunk/lib/php/src/protocol/TProtocol.php Fri Oct  7 00:17:25 2011
@@ -262,7 +262,8 @@ abstract class TProtocol {
         return $result;
       }
     default:
-      return 0;
+      throw new TProtocolException('Unknown field type: '.$type,
+                                   TProtocolException::INVALID_DATA);
     }
   }
 
@@ -356,7 +357,8 @@ abstract class TProtocol {
         return $result;
       }
     default:
-      return 0;
+      throw new TProtocolException('Unknown field type: '.$type,
+                                   TProtocolException::INVALID_DATA);
     }
   }
 }