THRIFT-3896 fix map type with string key can not access deserialized by php extension
Client: php
Patch: feidong@anjuke.com
This closes #1062
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
index a0de645..f9b3ad7 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
@@ -543,7 +543,7 @@
}
else {
if (Z_TYPE_P(key) != IS_STRING) convert_to_string(key);
- zend_hash_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
+ zend_symtable_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
}
zval_ptr_dtor(&key);
}
@@ -589,7 +589,7 @@
}
else {
if (Z_TYPE_P(key) != IS_STRING) convert_to_string(key);
- zend_hash_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
+ zend_symtable_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
}
zval_ptr_dtor(&key);
}
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
index 59fa30a..13cdf22 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
@@ -594,7 +594,7 @@
zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value);
} else {
if (Z_TYPE(key) != IS_STRING) convert_to_string(&key);
- zend_hash_update(Z_ARR_P(return_value), Z_STR(key), &value);
+ zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value);
}
}
return; // return_value already populated
@@ -634,7 +634,7 @@
zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value);
} else {
if (Z_TYPE(key) != IS_STRING) convert_to_string(&key);
- zend_hash_update(Z_ARR_P(return_value), Z_STR(key), &value);
+ zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value);
}
}
return;