aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Stanley Cheung <stanleycheung@google.com>2016-02-16 09:36:36 -0800
committerGravatar Stanley Cheung <stanleycheung@google.com>2016-02-16 09:36:36 -0800
commitb91f0f27c5cfd92b5f9358fe54f556fec6005d22 (patch)
tree2b0447e6d5ef163c7b7ccc7ea1a74555c35ea84e
parentcccf9295e6e6d2da8c8c283b5c1ee0001975e525 (diff)
revert unnecessary change
-rw-r--r--src/php/ext/grpc/call.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c
index 4b4336666c..024ab70571 100644
--- a/src/php/ext/grpc/call.c
+++ b/src/php/ext/grpc/call.c
@@ -125,9 +125,15 @@ zval *grpc_parse_metadata_array(grpc_metadata_array *metadata_array) {
memcpy(str_val, elem->value, elem->value_length);
if (zend_hash_find(array_hash, str_key, key_len, (void **)data) ==
SUCCESS) {
- zend_throw_exception(zend_exception_get_default(),
- "Metadata hash somehow contains wrong types.",
- 1 TSRMLS_CC);
+ if (Z_TYPE_P(*data) != IS_ARRAY) {
+ zend_throw_exception(zend_exception_get_default(),
+ "Metadata hash somehow contains wrong types.",
+ 1 TSRMLS_CC);
+ efree(str_key);
+ efree(str_val);
+ return NULL;
+ }
+ add_next_index_stringl(*data, str_val, elem->value_length, false);
} else {
MAKE_STD_ZVAL(inner_array);
array_init(inner_array);