From 51700649d0adbd0bbdf407ba251170a29f04e691 Mon Sep 17 00:00:00 2001 From: Jake Farrell Date: Fri, 7 Oct 2011 00:17:25 +0000 Subject: [PATCH] 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 --- lib/php/src/protocol/TProtocol.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); } } } -- 2.17.1