1--TEST-- 2JIT FETCH_DIM_R: 003 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.file_update_protection=0 7;opcache.jit_debug=257 8--EXTENSIONS-- 9opcache 10--FILE-- 11<?php 12function foo() { 13 $a = "ABCDEF"; 14 var_dump($a[0]); 15 var_dump($a[2]); 16 var_dump($a[1.0]); 17 var_dump($a["0"]); 18 var_dump($a["2"]); 19 var_dump($a[false]); 20 var_dump($a[true]); 21 var_dump($a[null]); 22 try { 23 var_dump($a["ab"]); 24 } catch (\TypeError $e) { 25 echo $e->getMessage() . \PHP_EOL; 26 } 27 $x = "a"; 28 $y = "b"; 29 try { 30 var_dump($a[$x . $y]); 31 } catch (\TypeError $e) { 32 echo $e->getMessage() . \PHP_EOL; 33 } 34 var_dump($a["2x"]); 35 $x = "2"; 36 $y = "x"; 37 var_dump($a[$x . $y]); 38} 39foo(); 40?> 41--EXPECTF-- 42string(1) "A" 43string(1) "C" 44 45Warning: String offset cast occurred in %s on line %d 46string(1) "B" 47string(1) "A" 48string(1) "C" 49 50Warning: String offset cast occurred in %s on line %d 51string(1) "A" 52 53Warning: String offset cast occurred in %s on line %d 54string(1) "B" 55 56Warning: String offset cast occurred in %s on line %d 57string(1) "A" 58Cannot access offset of type string on string 59Cannot access offset of type string on string 60 61Warning: Illegal string offset "2x" in %sfetch_dim_r_003.php on line 24 62string(1) "C" 63 64Warning: Illegal string offset "2x" in %sfetch_dim_r_003.php on line 27 65string(1) "C" 66