aboutsummaryrefslogtreecommitdiffhomepage
path: root/conformance/conformance_php.php
diff options
context:
space:
mode:
authorGravatar Yilun Chong <yilunchong@google.com>2017-06-27 18:24:15 -0700
committerGravatar Yilun Chong <yilunchong@google.com>2017-06-27 18:24:15 -0700
commit18a0c2c4d2894e820f96494f33d8ca3ea33dec3a (patch)
treeba6297a500f23a17ba2844f3daeae0f02561ac80 /conformance/conformance_php.php
parent2ad74e1606728564cc777aa4917d7e2299317eda (diff)
add proto2 supported for cpp,python,nodejs,ruby,php
Diffstat (limited to 'conformance/conformance_php.php')
-rwxr-xr-xconformance/conformance_php.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/conformance/conformance_php.php b/conformance/conformance_php.php
index 20fb5082..848cb4c7 100755
--- a/conformance/conformance_php.php
+++ b/conformance/conformance_php.php
@@ -45,11 +45,18 @@ function doTest($request)
$test_message = new \Protobuf_test_messages\Proto3\TestAllTypes();
$response = new \Conformance\ConformanceResponse();
if ($request->getPayload() == "protobuf_payload") {
- try {
+ if ($request->getMessageType() == "proto3") {
+ try {
$test_message->mergeFromString($request->getProtobufPayload());
- } catch (Exception $e) {
+ } catch (Exception $e) {
$response->setParseError($e->getMessage());
return $response;
+ }
+ } elseif ($request->getMessageType() == "proto2") {
+ $response->setSkipped("PHP doesn't support proto2");
+ return $response;
+ } else {
+ trigger_error("Protobuf request doesn't have specific payload type", E_USER_ERROR);
}
} elseif ($request->getPayload() == "json_payload") {
try {