1--TEST--
2Test nullsafe in new
3--FILE--
4<?php
5
6class Bar {}
7
8class Foo {
9    public $bar;
10}
11
12$foo = new Foo();
13$foo->bar = 'bar';
14var_dump(new $foo?->bar);
15
16$foo = null;
17var_dump(new $foo?->bar);
18
19?>
20--EXPECTF--
21object(Bar)#2 (0) {
22}
23
24Fatal error: Uncaught Error: Class name must be a valid object or a string in %s.php:14
25Stack trace:
26#0 {main}
27  thrown in %s.php on line 14
28