1--TEST--
2Assigning stringable object to static string property
3--FILE--
4<?php
5
6class Test1 {
7    public static $ref;
8}
9class Test2 {
10    public string $str = "str";
11}
12class Test3 {
13    public function __toString() {
14        $x = "foo";
15        return $x . "bar";
16    }
17}
18
19$test2 = new Test2;
20Test1::$ref =& $test2->str;
21Test1::$ref = new Test3;
22var_dump(Test1::$ref);
23
24?>
25--EXPECT--
26string(6) "foobar"
27