The UNDEF marker here is important to prevent the creation of
a reference to the property currently being overwritten, which
would then leak.
This fixes oss-fuzz
6029559193534464, which was incorrectly
merged into oss-fuzz #30584 (which is reported at
https://github.com/google/oss-fuzz/issues/5211).
--- /dev/null
+--TEST--
+Trying to create a reference to an overwritten declared property
+--FILE--
+<?php
+$str = <<<STR
+O:5:"Error":2:{S:8:"previous";N;S:8:"previous";R:2;}
+STR;
+var_dump(unserialize($str));
+?>
+--EXPECTF--
+Notice: unserialize(): Error at offset 51 of 52 bytes in %s on line %d
+bool(false)
}
var_push_dtor(var_hash, old_data);
Z_TRY_DELREF_P(old_data);
- ZVAL_NULL(old_data);
+ ZVAL_UNDEF(old_data);
data = old_data;
} else {
int ret = is_property_visibility_changed(obj->ce, &key);