xref: /PHP-8.0/Zend/tests/bug79155.phpt (revision f8d79582)
1--TEST--
2Bug #79155: Property nullability lost when using multiple property definition
3--FILE--
4<?php
5
6class Foo {
7    public ?string $a, $b;
8    public ?stdClass $c, $d;
9}
10
11$t = new Foo;
12$t->a = "str";
13$t->b = "str";
14$t->c = new stdClass;
15$t->d = new stdClass;
16
17var_dump($t->a, $t->b, $t->c, $t->d);
18
19$t->a = null;
20$t->b = null;
21$t->c = null;
22$t->d = null;
23var_dump($t->a, $t->b, $t->c, $t->d);
24
25?>
26--EXPECT--
27string(3) "str"
28string(3) "str"
29object(stdClass)#2 (0) {
30}
31object(stdClass)#3 (0) {
32}
33NULL
34NULL
35NULL
36NULL
37