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