1--TEST--
2CONST/CV should not be freed on failed reference assignment
3--FILE--
4<?php
5class Test {
6    public ?Type $prop;
7}
8$obj = new Test;
9$ref =& $obj->prop;
10try {
11    $ref = [1];
12} catch (TypeError $e) {
13    echo $e->getMessage(), "\n";
14}
15try {
16    $ary = [1];
17    $ref = $ary;
18} catch (TypeError $e) {
19    echo $e->getMessage(), "\n";
20}
21var_dump($ref);
22?>
23--EXPECT--
24Cannot assign array to reference held by property Test::$prop of type ?Type
25Cannot assign array to reference held by property Test::$prop of type ?Type
26NULL
27