From: Jake Farrell Date: Fri, 7 Oct 2011 00:17:25 +0000 (+0000) Subject: Thrift-1377: abort PHP deserialization on unknown field type X-Git-Tag: 0.8.0~60 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=51700649d0adbd0bbdf407ba251170a29f04e691;p=common%2Fthrift.git 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. git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1179907 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/php/src/protocol/TProtocol.php b/lib/php/src/protocol/TProtocol.php index ac1facde..239648e7 100644 --- a/lib/php/src/protocol/TProtocol.php +++ b/lib/php/src/protocol/TProtocol.php @@ -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); } } }