Skip to content

Commit c586aaa

Browse files
committed
create copy of value
1 parent 4335e73 commit c586aaa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rapidjson.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ PHP_METHOD(rapidjson, offsetSet) /* {{{ */ {
192192
Value& val = (*document)[key->val];
193193

194194
if (IS_STRING == Z_TYPE_P(value)) {
195-
val.SetString(Z_STRVAL_P(value), Z_STRLEN_P(value));
195+
zval *copy;
196+
*copy = *value;
197+
val.SetString(Z_STRVAL_P(copy), Z_STRLEN_P(copy));
196198
} else if (IS_LONG == Z_TYPE_P(value)) {
197199
val.SetInt64(Z_LVAL_P(value));
198200
} else if (IS_NULL == Z_TYPE_P(value)) {

0 commit comments

Comments
 (0)