File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Overwriting a typed property reference
3
+ --FILE--
4
+ <?php
5
+
6
+ class Test {
7
+ public ?object $ prop ;
8
+ }
9
+ $ s = <<<'STR'
10
+ O:4:"Test":2:{s:4:"prop";R:1;s:4:"prop";N;}}
11
+ STR;
12
+ var_dump (unserialize ($ s ));
13
+
14
+ ?>
15
+ --EXPECT--
16
+ object(Test)#1 (1) {
17
+ ["prop"]=>
18
+ NULL
19
+ }
Original file line number Diff line number Diff line change @@ -556,6 +556,10 @@ string_key:
556
556
/* This is a property with a declaration */
557
557
old_data = Z_INDIRECT_P (old_data);
558
558
info = zend_get_typed_property_info_for_slot (obj, old_data);
559
+ if (Z_ISREF_P (old_data)) {
560
+ /* If the value is overwritten, remove old type source from ref. */
561
+ ZEND_REF_DEL_TYPE_SOURCE (Z_REF_P (old_data), info);
562
+ }
559
563
var_push_dtor (var_hash, old_data);
560
564
Z_TRY_DELREF_P (old_data);
561
565
ZVAL_COPY_VALUE (old_data, &d);
You can’t perform that action at this time.
0 commit comments