1--TEST--
2JIT FETCH_DIM_R: 004
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($n) {
13    $a = "ABCDEF";
14    try {
15        var_dump($a[$n]);
16    } catch (\TypeError $e) {
17        echo $e->getMessage() . \PHP_EOL;
18    }
19}
20foo(0);
21foo(2);
22foo(1.0);
23foo("0");
24foo("2");
25foo(false);
26foo(true);
27foo(null);
28foo("ab");
29$x="a";
30$y="b";
31foo($x.$y);
32foo("2x");
33$x=2;
34$y="x";
35foo($x.$y);
36?>
37--EXPECTF--
38string(1) "A"
39string(1) "C"
40
41Warning: String offset cast occurred in %s on line %d
42string(1) "B"
43string(1) "A"
44string(1) "C"
45
46Warning: String offset cast occurred in %s on line %d
47string(1) "A"
48
49Warning: String offset cast occurred in %s on line %d
50string(1) "B"
51
52Warning: String offset cast occurred in %s on line %d
53string(1) "A"
54Cannot access offset of type string on string
55Cannot access offset of type string on string
56
57Warning: Illegal string offset "2x" in %sfetch_dim_r_004.php on line 5
58string(1) "C"
59
60Warning: Illegal string offset "2x" in %sfetch_dim_r_004.php on line 5
61string(1) "C"
62