aboutsummaryrefslogtreecommitdiff
path: root/php/ext/google/protobuf/type_check.c
diff options
context:
space:
mode:
authorJisi Liu <liujisi@google.com>2018-01-04 14:26:24 -0800
committerGitHub <noreply@github.com>2018-01-04 14:26:24 -0800
commita3868af12be724f808faa21a29e7b4931e30bed1 (patch)
tree3df23c4174287023b569108eb133db0f9c310646 /php/ext/google/protobuf/type_check.c
parenteca1d2a7113b3d57f900f69661342c0078c956c4 (diff)
parentec826c5a592126ddb6b12b47e6e1fb6232ce340d (diff)
downloadprotobuf-a3868af12be724f808faa21a29e7b4931e30bed1.tar.gz
protobuf-a3868af12be724f808faa21a29e7b4931e30bed1.tar.bz2
protobuf-a3868af12be724f808faa21a29e7b4931e30bed1.zip
Merge pull request #4131 from pherl/merge
Merge 3.5.x branch into master
Diffstat (limited to 'php/ext/google/protobuf/type_check.c')
-rw-r--r--php/ext/google/protobuf/type_check.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c
index f588774c..85f5051e 100644
--- a/php/ext/google/protobuf/type_check.c
+++ b/php/ext/google/protobuf/type_check.c
@@ -461,8 +461,7 @@ void check_repeated_field(const zend_class_entry* klass, PHP_PROTO_LONG type,
CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)memory) TSRMLS_CC);
}
- Z_DELREF_P(CACHED_TO_ZVAL_PTR(repeated_field));
- RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 0);
+ RETURN_ZVAL(CACHED_TO_ZVAL_PTR(repeated_field), 1, 1);
} else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!instanceof_function(Z_OBJCE_P(val), repeated_field_type TSRMLS_CC)) {
@@ -533,10 +532,10 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type,
map_field_handlers->write_dimension(
CACHED_TO_ZVAL_PTR(map_field), &key,
CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC);
+ zval_dtor(&key);
}
- Z_DELREF_P(CACHED_TO_ZVAL_PTR(map_field));
- RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 0);
+ RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1);
} else if (Z_TYPE_P(val) == IS_OBJECT) {
if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) {
zend_error(E_USER_ERROR, "Given value is not an instance of %s.",