File size: 729 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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--
Type inference 001: Invalid type narrowing warning
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--FILE--
<?php
function test() {
    for ($i = 0; $i < 2; $i++) {
        $obj->x;
        $obj = new stdClass;
    }
}
test();

class Test {
    public int $x = 1;
}

function test2() {
    for ($i = 0; $i < 2; $i++) {
        $obj->x;
        $obj = new Test;
    }
}
test2();
?>
DONE
--EXPECTF--
Warning: Undefined variable $obj in %s on line %d

Warning: Attempt to read property "x" on null in %s on line %d

Warning: Undefined property: stdClass::$x in %s on line %d

Warning: Undefined variable $obj in %s on line %d

Warning: Attempt to read property "x" on null in %s on line %d
DONE