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