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