blob: 8e6be312c6d89192bc2e70c4ae52313f8a3d4f3d (
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
33
34
35
36
37
38
39
40
41
|
--TEST--
Typed property must be compatible when returned via &__get()
--FILE--
<?php
class Test {
public $prop = "x";
public int $val;
public function &__get($name) {
return $this->prop;
}
}
$test = new Test;
$dummyRef = &$test->prop;
var_dump($test);
try {
var_dump($test->val);
} catch (TypeError $e) { print $e->getMessage()."\n"; }
var_dump($test);
$test->prop = "y";
var_dump($test->prop);
?>
--EXPECT--
object(Test)#1 (1) {
["prop"]=>
&string(1) "x"
["val"]=>
uninitialized(int)
}
Typed property Test::$val must be int, string used
object(Test)#1 (1) {
["prop"]=>
&string(1) "x"
["val"]=>
uninitialized(int)
}
string(1) "y"
|