diff --git a/ext/standard/var.c b/ext/standard/var.c index 08806f9698eed..16b9fffba1109 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -958,7 +958,7 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_ } if (Z_ISREF_P(data) && Z_REFCOUNT_P(data) == 1) { - ZVAL_UNREF(data); + data = Z_REFVAL_P(data); } /* we should still add element even if it's not OK,