1--TEST--
2JIT: FETCH_OBJ
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7--EXTENSIONS--
8opcache
9--FILE--
10<?php
11function foo(&$a) {
12    $a = 2;
13}
14
15function foo2(&$a) {
16    $a = array();
17}
18
19function foo3(&$a, $var) {
20    $a = $var;
21}
22
23$obj = new stdClass;
24foo($obj->a);
25var_dump($obj);
26foo2($obj->b);
27var_dump($obj);
28foo3($obj->a, "2" . "3");
29foo3($obj->a, $obj->b);
30var_dump($obj);
31
32$a = &$obj->a;
33$a = fopen(__FILE__, "r");
34var_dump($obj);
35
36function bar() {
37    $obj = new stdClass;
38    foo($obj->a);
39    var_dump($obj);
40    foo2($obj->b);
41    var_dump($obj);
42    foo3($obj->a, "2" . "3");
43    foo3($obj->a, $obj->b);
44    var_dump($obj);
45
46    $a = &$obj->a;
47    $a = fopen(__FILE__, "r");
48    var_dump($obj);
49
50    $d = array();
51    try {
52        foo($d->{"ab" ."c"});
53    } catch (Error $err) {
54        echo $err->getMessage(), "\n";
55    }
56    var_dump($d);
57
58    $e = NULL;
59    try {
60        foo($e->{"ab" ."c"});
61    } catch (Error $err) {
62        echo $err->getMessage(), "\n";
63    }
64    var_dump($e);
65
66    $f = "";
67    try {
68        foo($f->{"ab" ."c"});
69    } catch (Error $err) {
70        echo $err->getMessage(), "\n";
71    }
72    var_dump($f);
73}
74
75bar();
76?>
77--EXPECTF--
78object(stdClass)#%d (1) {
79  ["a"]=>
80  int(2)
81}
82object(stdClass)#%d (2) {
83  ["a"]=>
84  int(2)
85  ["b"]=>
86  array(0) {
87  }
88}
89object(stdClass)#%d (2) {
90  ["a"]=>
91  array(0) {
92  }
93  ["b"]=>
94  array(0) {
95  }
96}
97object(stdClass)#%d (2) {
98  ["a"]=>
99  &resource(5) of type (stream)
100  ["b"]=>
101  array(0) {
102  }
103}
104object(stdClass)#%d (1) {
105  ["a"]=>
106  int(2)
107}
108object(stdClass)#%d (2) {
109  ["a"]=>
110  int(2)
111  ["b"]=>
112  array(0) {
113  }
114}
115object(stdClass)#%d (2) {
116  ["a"]=>
117  array(0) {
118  }
119  ["b"]=>
120  array(0) {
121  }
122}
123object(stdClass)#%d (2) {
124  ["a"]=>
125  &resource(6) of type (stream)
126  ["b"]=>
127  array(0) {
128  }
129}
130Attempt to modify property "abc" on array
131array(0) {
132}
133Attempt to modify property "abc" on null
134NULL
135Attempt to modify property "abc" on string
136string(0) ""
137