blob: d6e057546b381af79b0b16bfe438485078e385c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
--TEST--
Bug #80037: Typed property must not be accessed before initialization when __get() declared
--FILE--
<?php
final class A
{
public string $a;
public static function fromArray(array $props): self
{
$me = new static;
foreach ($props as $k => &$v) {
$me->{$k} = &$v; # try to remove &
}
return $me;
}
public function __get($name)
{
throw new \LogicException("Property '$name' is not defined.");
}
}
var_dump(A::fromArray(['a' => 'foo']));
?>
--EXPECT--
object(A)#1 (1) {
["a"]=>
string(3) "foo"
}
|