Skip to content

Commit 7a5bdb1

Browse files
committed
PS_SERIALIZER_DECODE_FUNC did not properly handle the case when passed a encoded value where the top level was a reference
1 parent 36f8d32 commit 7a5bdb1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

msgpack.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,14 @@ PS_SERIALIZER_DECODE_FUNC(msgpack) /* {{{ */ {
168168
mp.user.var_hash = &var_hash;
169169

170170
ret = template_execute(&mp, val, vallen, &off);
171+
if (Z_TYPE_P(mp.user.retval) == IS_REFERENCE) {
172+
ZVAL_DEREF(mp.user.retval);
173+
}
171174

172175
if (ret == MSGPACK_UNPACK_EXTRA_BYTES || ret == MSGPACK_UNPACK_SUCCESS) {
173176
msgpack_unserialize_var_destroy(&var_hash, 0);
174177

175-
ZEND_HASH_FOREACH_STR_KEY_VAL(HASH_OF(&tmp), key_str, value) {
178+
ZEND_HASH_FOREACH_STR_KEY_VAL(HASH_OF(mp.user.retval), key_str, value) {
176179
if (key_str) {
177180
php_set_session_var(key_str, value, NULL);
178181
php_add_session_var(key_str);

0 commit comments

Comments
 (0)